org.spongycastle.crypto.paddings.PKCS7Padding Java Examples

The following examples show how to use org.spongycastle.crypto.paddings.PKCS7Padding. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IoUtil.java    From OpenYOLO-Android with Apache License 2.0 5 votes vote down vote up
static PaddedBufferedBlockCipher createAes128CtrPkcs7PaddingCipher(
        boolean encrypting,
        byte[] iv,
        byte[] key) {
    AESEngine aes = new AESEngine();
    SICBlockCipher aesCtr = new SICBlockCipher(aes);
    PaddedBufferedBlockCipher aesCtrPkcs7 =
            new PaddedBufferedBlockCipher(aesCtr, new PKCS7Padding());
    aesCtrPkcs7.init(encrypting, new ParametersWithIV(new KeyParameter(key), iv));

    return aesCtrPkcs7;
}