PointyCastle / pointycastle

Moved into the Bouncy Castle project: https://github.com/bcgit/pc-dart
MIT License
270 stars 76 forks source link

AES/ECB/PKCS7Padding cannot be implemented #167

Closed tangzejin921 closed 5 years ago

tangzejin921 commented 5 years ago

I want to use AES/ECB/PKCS7Padding But code error reporting CODE: var key = utf8.encode("0123456789abcdef"); var iv = utf8.encode(""); CipherParameters params = new PaddedBlockCipherParameters(new ParametersWithIV(new KeyParameter(key), iv), null);

PaddedBlockCipherImpl cipherImpl = new PaddedBlockCipherImpl(new PKCS7Padding(), new ECBBlockCipher(new AESFastEngine())); cipherImpl.init(true, params); var process = cipherImpl.process(utf8.encode("test")); print(process);

ERR:

type 'ParametersWithIV' is not a subtype of type 'KeyParameter' of 'params'

0 AESFastEngine.init (package:pointycastle/block/aes_fast.dart)

1 ECBBlockCipher.init (package:pointycastle/block/modes/ecb.dart:37:23)

#

tangzejin921 commented 5 years ago

I should use ipherParameters params = new PaddedBlockCipherParameters(new KeyParameter(key), null);