Skip to content

Instantly share code, notes, and snippets.

@rsatrio
Created May 7, 2022 22:56
Show Gist options
  • Save rsatrio/d6a0adf4b532d73d00d98074f2d8cc97 to your computer and use it in GitHub Desktop.
Save rsatrio/d6a0adf4b532d73d00d98074f2d8cc97 to your computer and use it in GitHub Desktop.
Get Signature Algorithm
if(signerInfo.getEncryptionAlgOID().trim().equals("1.2.840.113549.1.1.1")) {
encAlgo="RSA";
}
if(encAlgo!=null) {
if(digest.getAlgorithm().equals("1.3.14.3.2.26")) {
encAlgo="SHA1withRSA";
}
else if(digest.getAlgorithm().equals("2.16.840.1.101.3.4.2.1")) {
encAlgo="SHA256withRSA";
}
else if(digest.getAlgorithm().equals("2.16.840.1.101.3.4.2.2")) {
encAlgo="SHA384withRSA";
}
else if(digest.getAlgorithm().equals("2.16.840.1.101.3.4.2.3")) {
encAlgo="SHA512withRSA";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment