You need to sign in to do that
Don't have an account?
Kanagaraj Arjunan 11
Input length must be multiple of 16 when decrypting with padded cipher in salesforce
Hi All
I am trying to decrypt an attachment. while when i excecute the code i am receiving the error like "Input length must be multiple of 16 when decrypting with padded cipher in salesforce" below is my code.
global with sharing class decryptAttachment {
webservice static string decryptAttachmentfile(Id caseIds) {
c Document d = new Document();
d.FolderId = UserInfo.getUserId();
Attachment a = [SELECT Id, Name,ParentId,Body,ContentType FROM Attachment WHERE ParentId =:caseparentIds];
d.ContentType = a.contentType;
EncryptionKey__c keySetting = EncryptionKey__c.getOrgDefaults();
Blob aesKey = EncodingUtil.base64Decode(keySetting.aeskey__c);
d.Body = Crypto.decryptWithManagedIV('AES256', aesKey, a.Body);
d.Name = a.Name;
insert d;
return d.id;
}
}
I am trying to decrypt an attachment. while when i excecute the code i am receiving the error like "Input length must be multiple of 16 when decrypting with padded cipher in salesforce" below is my code.
global with sharing class decryptAttachment {
webservice static string decryptAttachmentfile(Id caseIds) {
c Document d = new Document();
d.FolderId = UserInfo.getUserId();
Attachment a = [SELECT Id, Name,ParentId,Body,ContentType FROM Attachment WHERE ParentId =:caseparentIds];
d.ContentType = a.contentType;
EncryptionKey__c keySetting = EncryptionKey__c.getOrgDefaults();
Blob aesKey = EncodingUtil.base64Decode(keySetting.aeskey__c);
d.Body = Crypto.decryptWithManagedIV('AES256', aesKey, a.Body);
d.Name = a.Name;
insert d;
return d.id;
}
}