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ItQ0QtQk1SQS0wMDAwMDQoQk1SQS0wMDYpLmRvY3guZG9jeCIsIlNQQVJUQURNU19fRG9jdW1lbnRfTnVtYmVyX01ham9yX19jIjoiMSIsIlNQQVJUQURNU19fRG9jdW1lbnRfUmV2aXNpb25fQXRfQXBwcm92YWxfX2MiOjEsIlNQQVJUQURNU19fSXNfRmlsZV9VcGxvYWRlZF9fYyI6dHJ1ZSwiU1BBUlRBRE1TX19WZXJzaW9uX1N0YXR1c19fYyI6IkVmZmVjdGl2ZSIsIlNQQVJUQURNU19fUmV0ZW50aW9uX1BlcmlvZF9ZZWFyc19fYyI6IjEwIn0=';
  3. final Boolean isEncrypted = isBase64(coverPageDetail);
  4. if (isEncrypted) {
  5. coverPageDetail = decrypt(coverPageDetail);
  6. }
  7. system.debug('coverPageDetail@@'+coverPageDetail);
  8.  
  9. String decrypt(String encodedString) {
  10. return EncodingUtil.base64Decode(encodedString).toString();
  11. }
  12.  
  13. String encrypt(String plainString) {
  14. return EncodingUtil.base64Encode(Blob.valueOf(plainString));
  15. }
  16.  
  17. Boolean isBase64(String inputString) {
  18. String regexString = '^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$';
  19. return Pattern.matches(regexString, inputString);
  20. }
Success #stdin #stdout #stderr 0.01s 7832KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
./prog:1: expected expression