List of usage examples for org.bouncycastle.asn1.pkcs EncryptionScheme EncryptionScheme
public EncryptionScheme(ASN1ObjectIdentifier objectId, ASN1Encodable parameters)
From source file:org.xwiki.crypto.password.internal.pbe.factory.AbstractBcPBES2Rc5CipherFactory.java
License:Open Source License
@Override protected PasswordBasedCipher getPasswordBasedCipher(boolean forEncryption, KeyDerivationFunction kdf, SymmetricCipherParameters params) { return new AbstractBcPBES2Cipher(getCipherFactory().getInstance(forEncryption, params), kdf, params) { @Override/*from w w w . j ava2s . c om*/ protected EncryptionScheme getScheme(SymmetricCipherParameters parameters) { return new EncryptionScheme(ALG_ID, new RC5CBCParameter( ((RC5KeyParameters) ((KeyWithIVParameters) parameters).getKeyParameter()) .getRounds(), getOutputBlockSize(), ((KeyWithIVParameters) parameters).getIV())); } }; }
From source file:org.xwiki.crypto.password.internal.pbe.factory.BcPBES2AesCipherFactory.java
License:Open Source License
@Override protected PasswordBasedCipher getPasswordBasedCipher(boolean forEncryption, final KeyDerivationFunction kdf, SymmetricCipherParameters params) { /** Overwrite the key length with itself, since the key length will be encoded in the algorithm identifier */ kdf.overrideKeySize(kdf.getKeySize()); return new AbstractBcPBES2Cipher(getCipherFactory().getInstance(forEncryption, params), kdf, params) { @Override//from w w w . ja v a 2 s. c o m protected EncryptionScheme getScheme(SymmetricCipherParameters parameters) { return new EncryptionScheme( getAESAlgoritmIdentifier(((KeyWithIVParameters) parameters).getKey().length), new DEROctetString(((KeyWithIVParameters) parameters).getIV())); } }; }
From source file:org.xwiki.crypto.password.internal.pbe.factory.BcPBES2BlowfishCipherFactory.java
License:Open Source License
@Override protected PasswordBasedCipher getPasswordBasedCipher(boolean forEncryption, final KeyDerivationFunction kdf, SymmetricCipherParameters params) { return new AbstractBcPBES2Cipher(getCipherFactory().getInstance(forEncryption, params), kdf, params) { @Override/*from ww w .j a va 2 s .c om*/ protected EncryptionScheme getScheme(SymmetricCipherParameters parameters) { return new EncryptionScheme(ALG_ID, new DEROctetString(((KeyWithIVParameters) parameters).getIV())); } }; }
From source file:org.xwiki.crypto.password.internal.pbe.factory.BcPBES2DesEdeCipherFactory.java
License:Open Source License
@Override protected PasswordBasedCipher getPasswordBasedCipher(boolean forEncryption, KeyDerivationFunction kdf, SymmetricCipherParameters params) { return new AbstractBcPBES2Cipher(getCipherFactory().getInstance(forEncryption, params), kdf, params) { @Override//from ww w. j ava 2s .c o m protected EncryptionScheme getScheme(SymmetricCipherParameters parameters) { return new EncryptionScheme(PKCSObjectIdentifiers.des_EDE3_CBC, new DEROctetString(((KeyWithIVParameters) parameters).getIV())); } }; }
From source file:org.xwiki.crypto.password.internal.pbe.factory.BcPBES2Rc2CipherFactory.java
License:Open Source License
@Override protected PasswordBasedCipher getPasswordBasedCipher(boolean forEncryption, KeyDerivationFunction kdf, SymmetricCipherParameters params) { return new AbstractBcPBES2Cipher(getCipherFactory().getInstance(forEncryption, params), kdf, params) { @Override/*from ww w .j a va2 s .com*/ protected EncryptionScheme getScheme(SymmetricCipherParameters parameters) { return new EncryptionScheme(PKCSObjectIdentifiers.RC2_CBC, new RC2CBCParameter(getRC2Version((KeyWithIVParameters) parameters), ((KeyWithIVParameters) parameters).getIV())); } }; }