@Test public void Pbkdf2DecodingTest() throws Exception { byte[] password = PasswordToByteConverter.convert("password"); byte[] encoded = Base64.decode("MCYGCSqGSIb3DQEFDDAZBBAcO15L0rQ01O2RJ5UhyqCdAgID6AIBIA=="); KeyDerivationFunction kdf = getKDFInstance(new PBKDF2Parameters(32, 1000, Hex.decode( "1c3b5e4bd2b434d4ed91279521caa09d"))); KeyWithIVParameters params = kdf.derive(password, 8); KeyDerivationFunction kdf2 = factory.getInstance(encoded); KeyWithIVParameters params2 = kdf2.derive(password, 8); assertThat(kdf.getEncoded(), equalTo(encoded)); assertThat(params.getKey(), equalTo(params2.getKey())); assertThat(params2.getIV(), equalTo(params2.getIV())); }
@Override public KeyDerivationFunction getInstance(KeyDerivationFunctionParameters params) { return getFactory(params.getAlgorithmName()).getInstance(params); }
DefaultKeyDerivationFunctionFactory extends AbstractBcKDFFactory { @Override public KeyDerivationFunction getInstance(KeyDerivationFunctionParameters params) { return getFactory(params.getAlgorithmName()).getInstance(params); } }
DefaultKeyDerivationFunctionFactory extends AbstractBcKDFFactory { @Override public KeyDerivationFunction getInstance(KeyDerivationFunctionParameters params) { return getFactory(params.getAlgorithmName()).getInstance(params); }  }
DefaultKeyDerivationFunctionFactory extends AbstractBcKDFFactory { @Override public KeyDerivationFunction getInstance(KeyDerivationFunctionParameters params) { return getFactory(params.getAlgorithmName()).getInstance(params); }  @Override KeyDerivationFunction getInstance(KeyDerivationFunctionParameters params); @Override KeyDerivationFunction getInstance(byte[] encoded); @Override KeyDerivationFunction getInstance(ASN1Encodable parameters); }
DefaultKeyDerivationFunctionFactory extends AbstractBcKDFFactory { @Override public KeyDerivationFunction getInstance(KeyDerivationFunctionParameters params) { return getFactory(params.getAlgorithmName()).getInstance(params); }  @Override KeyDerivationFunction getInstance(KeyDerivationFunctionParameters params); @Override KeyDerivationFunction getInstance(byte[] encoded); @Override KeyDerivationFunction getInstance(ASN1Encodable parameters);  }