Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/java/org/jscep/message/PkiMessageDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ public PkiMessage<?> decode(final CMSSignedData pkiMessage)
.getCertificate( cert );
verifier = new JcaSimpleSignerInfoVerifierBuilder().build(javaCert.getPublicKey());
}
// ensure that the encoding used of the signed attributes are the one specified in the original message
signerInfo = new SCEPSignerInformation(signerInfo);
if (signerInfo.verify(verifier) == false) {
final String msg = "pkiMessage verification failed.";
LOGGER.warn(msg);
Expand Down Expand Up @@ -286,4 +288,16 @@ private FailInfo toFailInfo(final Attribute attr) {

return FailInfo.valueOf(Integer.valueOf(string.getString()));
}

private static class SCEPSignerInformation extends SignerInformation {

protected SCEPSignerInformation(SignerInformation baseInfo) {
super(baseInfo);
}

public byte[] getEncodedSignedAttributes()
throws IOException {
return signedAttributeSet.getEncoded();
}
}
}