2

I have to decode a long Signature field value to generate signature image. Please find code below. Can someone help me here?

public class AccountPDF111 
{   Public void AccountPDF111(){}
    Public Set<ID> s = new Set<ID>();
    Public List<BLOB> s1 = new List<BLOB>();
    Public  Map<id,List<Call2_vod__c>> mapProductEntity = new Map<id,List<Call2_vod__c>>();
    public Map<id,List<Call2_vod__c>> getm1(){

     for(Call2_vod__c c:[SELECT Account_vod__c FROM Call2_vod__c where signature_Date_vod__c != null  limit 100 ])
     {
     s.add(c.Account_vod__c);
      }

    for(Account p: [SELECT Id,  (Select Account_vod__r.name,Name,Call_Date_vod__c,signature_Date_vod__c  FROM Call2_vod__r where signature_Date_vod__c != null) from Account WHERE ID IN : s  ]) {
mapProductEntity.put(p.Id, p.Call2_vod__r);   
}

      return mapProductEntity;
    }

Public String algorithmName = 'RSA';
Public String key = 'pkcs8 format private key';   
public List<BLOB> gets1()
{
for(Call2_vod__c c:[SELECT signature_vod__c FROM Call2_vod__c where signature_Date_vod__c != null  limit 10 ])
     {
     //s.add(c.Sig_vod__c);
      // Decode the key from base64 to binary
Blob privateKey = EncodingUtil.base64Decode(key);
Blob input = Blob.valueOf(c.signature_vod__c);
Crypto.sign(algorithmName, input, privateKey);
s1.add(Crypto.sign(algorithmName, input, privateKey));

}
return s1;
}
}
  • You'll need to be clearer about what encoding you are trying to "decode" and what the overall purpose of the logic is. – Keith C Aug 8 '14 at 22:52
  • Hi Keith. Edited the signature field value.Sorry the latest code there now.Anyway it's working fine except the signature.Can you please have a look? – Testing_SFDC Aug 9 '14 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.