Skip to content

Commit

Permalink
PKCS#12 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Oct 12, 2015
1 parent e05009e commit 4386e76
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,21 @@ protected void engineInit(
{
throw new InvalidKeyException("Algorithm requires a PBE key");
}
param = PBE.Util.makePBEParameters(k.getEncoded(), PKCS12, digest, keySizeInBits, ivLength * 8, pbeSpec, cipher.getAlgorithmName());
if (key instanceof BCPBEKey)
{
if (((BCPBEKey)key).getParam() != null)
{
param = ((BCPBEKey)key).getParam();
}
else
{
param = PBE.Util.makePBEParameters(k.getEncoded(), PKCS12, digest, keySizeInBits, ivLength * 8, pbeSpec, cipher.getAlgorithmName());
}
}
else
{
param = PBE.Util.makePBEParameters(k.getEncoded(), PKCS12, digest, keySizeInBits, ivLength * 8, pbeSpec, cipher.getAlgorithmName());
}
if (param instanceof ParametersWithIV)
{
ivParam = (ParametersWithIV)param;
Expand Down

0 comments on commit 4386e76

Please sign in to comment.