LoginSignup
0
0

More than 3 years have passed since last update.

復号化のpad block corruptedエラー対応策

Posted at

エラー現象:FATAL_ERROR|System.SecurityException: pad block corrupted
暗号化クラス:
Blob cryptoKey = Crypto.generateAesKey(256);
Blob dataenc = blob.valueOf('Hello');
Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey , dataenc );
String b64Data = EncodingUtil.base64Encode(encryptedData);
System.debug('Encrypted' + b64Data);

復号化クラス:
Blob cryptoKey1 = Crypto.generateAesKey(256);
Blob data = EncodingUtil.base64Decode(b64Data);
Blob decryptedData = Crypto.decryptWithManagedIV('AES256', cryptoKey1 , data);
System.debug('Decrypted'+ decryptedData.toString());

暗号化クラス:
Blob cryptoKey = Crypto.generateAesKey(256);
Blob dataenc = blob.valueOf('Hello');
Blob encryptedData = Crypto.encryptWithManagedIV('AES256', cryptoKey , dataenc );
String b64Data = EncodingUtil.base64Encode(encryptedData);
System.debug('Encrypted' + b64Data);

復号化クラス:
Blob data = EncodingUtil.base64Decode(b64Data);
Blob decryptedData = Crypto.decryptWithManagedIV('AES256', 暗号化クラスのcryptoKey , data);
System.debug('Decrypted'+ decryptedData.toString());

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0