Example usage for org.bouncycastle.asn1.pkcs PKCSObjectIdentifiers encryptionAlgorithm

List of usage examples for org.bouncycastle.asn1.pkcs PKCSObjectIdentifiers encryptionAlgorithm

Introduction

In this page you can find the example usage for org.bouncycastle.asn1.pkcs PKCSObjectIdentifiers encryptionAlgorithm.

Prototype

ASN1ObjectIdentifier encryptionAlgorithm

To view the source code for org.bouncycastle.asn1.pkcs PKCSObjectIdentifiers encryptionAlgorithm.

Click Source Link

Document

1.2.840.113549.3

Usage

From source file:org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactory.java

License:Open Source License

private PasswordBasedCipherFactory getPBES2CipherFactory(EncryptionScheme scheme) {
    try {//from  ww  w.java 2  s.c  o  m
        if (scheme.getAlgorithm().equals(PKCSObjectIdentifiers.encryptionAlgorithm.branch("9"))) {
            RC5CBCParameter rc5Param = RC5CBCParameter.getInstance(scheme.getParameters());
            if (rc5Param.getBlockSizeInBits().intValue() > 64) {
                // RC5-CBC-Pad with a 128bits block size
                return manager.getInstance(PasswordBasedCipherFactory.class, "PBES2-RC5-64-CBC-Pad");
            }
        }
        return manager.getInstance(PasswordBasedCipherFactory.class, scheme.getAlgorithm().getId());
    } catch (ComponentLookupException e) {
        throw new UnsupportedOperationException("Password based cipher factory not found.", e);
    }
}