< prev index next >
src/share/classes/com/sun/crypto/provider/PBES2Parameters.java
Print this page
@@ -310,22 +310,30 @@
// the 'otherSource' ASN.1 CHOICE for 'salt' is not supported
throw new IOException("PBE parameter parsing error: "
+ "not an ASN.1 OCTET STRING tag");
}
iCount = pBKDF2_params.data.getInteger();
+
+ DerValue prf = null;
// keyLength INTEGER (1..MAX) OPTIONAL,
if (pBKDF2_params.data.available() > 0) {
DerValue keyLength = pBKDF2_params.data.getDerValue();
if (keyLength.tag == DerValue.tag_Integer) {
keysize = keyLength.getInteger() * 8; // keysize (in bits)
+ } else {
+ // Should be the prf
+ prf = keyLength;
}
}
// prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1
String kdfAlgo = "HmacSHA1";
+ if (prf == null) {
if (pBKDF2_params.data.available() > 0) {
- if (pBKDF2_params.tag == DerValue.tag_Sequence) {
- DerValue prf = pBKDF2_params.data.getDerValue();
+ prf = pBKDF2_params.data.getDerValue();
+ }
+ }
+ if (prf != null) {
kdfAlgo_OID = prf.data.getOID();
if (hmacWithSHA1_OID.equals(kdfAlgo_OID)) {
kdfAlgo = "HmacSHA1";
} else if (hmacWithSHA224_OID.equals(kdfAlgo_OID)) {
kdfAlgo = "HmacSHA224";
@@ -347,11 +355,10 @@
throw new IOException("PBE parameter parsing error: "
+ "not an ASN.1 NULL tag");
}
}
}
- }
return kdfAlgo;
}
private String parseES(DerValue encryptionScheme) throws IOException {
< prev index next >