fork download
  1. public static String decryptKey(String encryptedKey) {
  2. String b64 = encryptedKey.replaceAll('[_]', '/').replaceAll('[-]', '+');
  3. Integer mod = Math.mod(b64.length(), 4);
  4. if (mod > 0) {
  5. b64 += String.valueOf('===='.substring(0, 4 - mod));
  6. }
  7. Blob encryptedBlob = EncodingUtil.base64Decode(b64);
  8. Blob keyBlob = EncodingUtil.base64Decode(Helpers.getEncryptionKey());
  9. Blob decryptedBlob = Crypto.decryptWithManagedIV('AES256', keyBlob, encryptedBlob);
  10. String decryptedString = decryptedBlob.toString();
  11. if (decryptedString.startsWith('.')) {
  12. decryptedString = decryptedString.substring(1);
  13. }
  14. return decryptedString;
  15.  
Success #stdin #stdout #stderr 0.01s 9980KB
stdin
Standard input is empty
stdout
Object: nil error: did not understand #static
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject(Object)>>doesNotUnderstand: #static (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
Object: String error: did not understand #encryptedKey
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
String class(Object)>>doesNotUnderstand: #encryptedKey (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
stderr
./prog:2: parse error, expected '}'