• sudha rani 13
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 8
    Replies

I am working on the Encryption process.

I need to generate encrypted payload by following instructions from the below link: https://support.trustpilot.com/hc/en-us/articles/115004145087--Business-Generated-Links-for-developers-
I tried below code below:
 

String text = '{"email":"sudharani256@gamil.com","name":"Sudha Rani Y","ref":"1234"}';

Blob key = Crypto.generateAesKey(128);

Blob data = Blob.valueOf(text);

String clearText = '{"email":"sudharani256@gmail.com","name":"Sudha Rani Y","ref":"1234"}';

String b64Data = EncodingUtil.base64Encode(data);


String encryptKey = '/...................';

Blob cipherText = Crypto.encryptWithManagedIV('AES128', key, Blob.valueOf(clearText));

//note 1 add above iV in place of key
blob encryptedData = Crypto.encrypt('AES256', EncodingUtil.base64Decode(encryptKey),key,data);

//16 byte string. since characters used are ascii, each char is 1 byte.
//encrypted blob

String strMd5= EncodingUtil.base64Encode (Crypto.generateDigest('MD5',EncodingUtil.base64Decode('ekR0VlHRzQxIlNu0smkKh8sOOcfUAqwsw71g4fhHChA=')));


String algorithmName = 'HmacSHA256';


Blob hmacData = Crypto.generateMac(algorithmName, EncodingUtil.base64Decode(strMd5), data);

string input='...';  // what you want to sign

string privateKey= '...................';  // your private key
Blob keyTwo = Crypto.generateAesKey(256);

//blob rs256sig = Crypto.sign('RSA', data, EncodingUtil.base64Decode(encryptKey));

system.debug(EncodingUtil.urlEncode(EncodingUtil.base64Encode(key)+EncodingUtil.base64Encode(cipherText)+EncodingUtil.base64Encode(hmacData),'UTF-8'));
 


From the above code, I tried rs256sig instead of hmacData but getting error like "System.SecurityException: Invalid Crypto Key".
Please help me it is very needful.

I need to change Header on every page. is it possible?

 

If I keep content in apex: repeat and in the first iteration, if get content in two pages then we must get the same header in 1st and 2nd page and the different header on the 3rd page like that.

Hi 
Is it possible to create navigation menu programmatically?
If yes how?
I am not able to find which object helpful for that.
Which object holds navigation menus.

I think we need to insert through metadata integration.If yes which object/class holds navigation menu.

It's urgent pls help............................

I am working on the Encryption process.

I need to generate encrypted payload by following instructions from the below link: https://support.trustpilot.com/hc/en-us/articles/115004145087--Business-Generated-Links-for-developers-
I tried below code below:
 

String text = '{"email":"sudharani256@gamil.com","name":"Sudha Rani Y","ref":"1234"}';

Blob key = Crypto.generateAesKey(128);

Blob data = Blob.valueOf(text);

String clearText = '{"email":"sudharani256@gmail.com","name":"Sudha Rani Y","ref":"1234"}';

String b64Data = EncodingUtil.base64Encode(data);


String encryptKey = '/...................';

Blob cipherText = Crypto.encryptWithManagedIV('AES128', key, Blob.valueOf(clearText));

//note 1 add above iV in place of key
blob encryptedData = Crypto.encrypt('AES256', EncodingUtil.base64Decode(encryptKey),key,data);

//16 byte string. since characters used are ascii, each char is 1 byte.
//encrypted blob

String strMd5= EncodingUtil.base64Encode (Crypto.generateDigest('MD5',EncodingUtil.base64Decode('ekR0VlHRzQxIlNu0smkKh8sOOcfUAqwsw71g4fhHChA=')));


String algorithmName = 'HmacSHA256';


Blob hmacData = Crypto.generateMac(algorithmName, EncodingUtil.base64Decode(strMd5), data);

string input='...';  // what you want to sign

string privateKey= '...................';  // your private key
Blob keyTwo = Crypto.generateAesKey(256);

//blob rs256sig = Crypto.sign('RSA', data, EncodingUtil.base64Decode(encryptKey));

system.debug(EncodingUtil.urlEncode(EncodingUtil.base64Encode(key)+EncodingUtil.base64Encode(cipherText)+EncodingUtil.base64Encode(hmacData),'UTF-8'));
 


From the above code, I tried rs256sig instead of hmacData but getting error like "System.SecurityException: Invalid Crypto Key".
Please help me it is very needful.

Hi, 
I'm trying to encrypt json data by signing with HMAC. Code doesn't seem to generate the right link.  Please assist !! 
 
public class crypto1 
    {
    
				 public string encryptkeyy = '3kXLV1rnimLRd0of4TPGz7iu2Wdd+/hYdfdf/Dt6nnIk=';  
				 public string authkeyy =     '2BKulGe3CTWOxSHkwR6546XqkM62dNpFAeuuWhfevc4A=';
				 public string domain = 'XYZ.com';
				
				 
				 public void crpytofunction(){
				 
				 string order   = '{ "email":"john@doe.com","name":"John Doe","ref":"1234"}';
				 
				
				
				 
				
				
				Blob encKey = EncodingUtil.base64Decode(encryptkeyy );
			  
				
				
				 Blob authKey = EncodingUtil.base64Decode(authkeyy);
				
				
				Blob data = Blob.valueOf(order);
				
			   // string s =  String.valueOf(Crypto.getRandomInteger());

				
				//Initialization vector
				  Blob encryptedBlob = Crypto.encryptWithManagedIV('AES256',authKey,data);
				  
			  
				  String encodedCipherText = EncodingUtil.base64Encode(encryptedBlob );  // all good until here .. 
				   
				   string payload = EncodingUtil.urlEncode(encodedCipherText,'UTF-8');
				   
				   Blob data1 = crypto.generateMac('HmacSHA256', encryptedBlob, authKey );  // problem with this part. 
				   
				   String anotherone = EncodingUtil.base64Encode(data1);
			
			  
					string link =  'https://www.trustpilot.com/evaluate-bgl/xyz.com?'+anotherone

     
    } 
    
   
      
    
    
    }

 
Hello,

What are some free and paid ways to integrate Saleforce with Trust-pilotWebsite

thansk for suggestion