List of usage examples for org.bouncycastle.asn1.pkcs KeyDerivationFunc toASN1Primitive
public ASN1Primitive toASN1Primitive()
From source file:org.xwiki.crypto.password.internal.pbe.factory.AbstractBcPBES2CipherFactory.java
License:Open Source License
protected KeyDerivationFunction getKeyDerivationFunction(KeyDerivationFunc func) { KeyDerivationFunctionFactory kdfFactory = safeGetKDFFactory(); // Optimization if (kdfFactory instanceof AbstractBcKDFFactory) { return ((AbstractBcKDFFactory) kdfFactory).getInstance(func); }//from www . j av a2s . c o m // Generic fallback try { return kdfFactory.getInstance(func.toASN1Primitive().getEncoded()); } catch (IOException e) { // Very unlikely to happen throw new RuntimeException("Unexpected exception during parameter encoding"); } }