function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
in apex use String orgId = UserInfo.getOrganizationId();
Please let me know detailed problem u have.
public class CryptoTest {
public CryptoTest (ApexPages.StandardController acon) { }
String MySessionID = UserInfo.getSessionID();
String conId = ApexPages.currentPage().getParameters().get('Id');
String EmailCon=[Select email from Contact where Id=:conId ].email;
String myurl= URL.getSalesforceBaseUrl().toExternalForm() + '/services/Soap/c/10.0/' + UserInfo.getOrganizationId();
public String getFoo() {
string c='eU9WzoFgU4n8Apu5PYxcNGRZswRDZJWDEMdbQVU85gw=';
if(String.IsBlank(EmailCon)){ EmailCon='';}
Blob cryptoKey= EncodingUtil.base64Decode(c);
Blob data = Blob.valueOf(MySessionID );
Blob data1 = Blob.valueOf(myurl);
Blob data2 = Blob.valueOf(conId);
Blob data3 = Blob.valueOf(EmailCon);
Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey, data);
Blob encryptedData1 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data1);
Blob encryptedData2 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data2);
Blob encryptedData3 = Crypto.encryptWithManagedIV('AES256', cryptoKey, data3 );
String b64Data = EncodingUtil.base64Encode(encryptedData);
String b64Data1 = EncodingUtil.base64Encode(encryptedData1);
String b64Data2 = EncodingUtil.base64Encode(encryptedData2);
String b64Data3 = EncodingUtil.base64Encode(encryptedData3);
String testurl='sessionID='+EncodingUtil.urlEncode(b64Data, 'UTF-8')+'&serverUrl='+EncodingUtil.urlEncode(b64Data1, 'UTF-8')+'&contactID='+EncodingUtil.urlEncode(b64Data2, 'UTF-8')+'&email='+EncodingUtil.urlEncode(b64Data3, 'UTF-8');
return testurl;
}
}