Skip to content

Instantly share code, notes, and snippets.

@rsatrio
Created May 7, 2022 22:51
Show Gist options
  • Save rsatrio/9b8da632c010da20af6cde12445397b5 to your computer and use it in GitHub Desktop.
Save rsatrio/9b8da632c010da20af6cde12445397b5 to your computer and use it in GitHub Desktop.
Get Message Digest Algorithm
MessageDigest digest=MessageDigest.getInstance(signerInfo.getDigestAlgOID());
//Get Attribute
Attribute attribute1 =signerInfo.getSignedAttributes().get(PKCSObjectIdentifiers.pkcs_9_at_messageDigest);
Attribute attribute2=null;
if(signerInfo.getUnsignedAttributes()!=null) {
attribute2 =signerInfo.getUnsignedAttributes().get(PKCSObjectIdentifiers.id_aa_signatureTimeStampToken);
}
messageDigest=Base64.getEncoder().encodeToString(
Hex.decode(attribute1.getAttributeValues()[0].toString().substring(1)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment