Class SignatureMechanisms


  • public class SignatureMechanisms
    extends java.lang.Object
    Class that contains OID mappings to extract a signature algorithm name from a signature mechanism OID, and conversely, to retrieve the appropriate signature mechanism OID given a signature algorithm and a digest function.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static java.util.Map<java.lang.String,​java.lang.String> algorithmNames
      Maps IDs of signature algorithms with its human-readable name.
      private static IBouncyCastleFactory BOUNCY_CASTLE_FACTORY  
      (package private) static java.util.Map<java.lang.String,​java.lang.String> dsaOidsByDigest  
      (package private) static java.util.Map<java.lang.String,​java.lang.String> ecdsaOidsByDigest  
      private static org.slf4j.Logger LOGGER  
      (package private) static java.util.Map<java.lang.String,​java.lang.String> rsaOidsByDigest  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getAlgorithm​(java.lang.String oid)
      Gets the algorithm name for a certain id.
      static java.lang.String getMechanism​(java.lang.String oid, java.lang.String digest)
      Get the signing mechanism name for a certain id and digest.
      static java.lang.String getSignatureMechanismOid​(java.lang.String signatureAlgorithmName, java.lang.String digestAlgorithmName)
      Attempt to look up the most specific OID for a given signature-digest combination.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • algorithmNames

        static final java.util.Map<java.lang.String,​java.lang.String> algorithmNames
        Maps IDs of signature algorithms with its human-readable name.
      • rsaOidsByDigest

        static final java.util.Map<java.lang.String,​java.lang.String> rsaOidsByDigest
      • dsaOidsByDigest

        static final java.util.Map<java.lang.String,​java.lang.String> dsaOidsByDigest
      • ecdsaOidsByDigest

        static final java.util.Map<java.lang.String,​java.lang.String> ecdsaOidsByDigest
    • Constructor Detail

      • SignatureMechanisms

        public SignatureMechanisms()
    • Method Detail

      • getSignatureMechanismOid

        public static java.lang.String getSignatureMechanismOid​(java.lang.String signatureAlgorithmName,
                                                                java.lang.String digestAlgorithmName)
        Attempt to look up the most specific OID for a given signature-digest combination.
        Parameters:
        signatureAlgorithmName - the name of the signature algorithm
        digestAlgorithmName - the name of the digest algorithm, if any
        Returns:
        an OID string, or null if none was found.
      • getAlgorithm

        public static java.lang.String getAlgorithm​(java.lang.String oid)
        Gets the algorithm name for a certain id.
        Parameters:
        oid - an id (for instance "1.2.840.113549.1.1.1")
        Returns:
        an algorithm name (for instance "RSA")
      • getMechanism

        public static java.lang.String getMechanism​(java.lang.String oid,
                                                    java.lang.String digest)
        Get the signing mechanism name for a certain id and digest.
        Parameters:
        oid - an id of an algorithm
        digest - digest of an algorithm
        Returns:
        name of the mechanism