Class AlgorithmId

  • All Implemented Interfaces:
    java.io.Serializable

    public class AlgorithmId
    extends java.lang.Object
    implements java.io.Serializable
    Use this class to get OID of supported algorithms see get(String) The OID is handled in it's String format in this class. example 1.2.840.113549.1.1.11 for "SHA256withRSA"
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      AlgorithmId()
      Deprecated.
      use one of the other constructors.
      AlgorithmId​(java.lang.String oid)
      Constructs a parameterless algorithm ID.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object other)
      Compares this AlgorithmID to another.
      boolean equals​(java.lang.String id)
      Compares two algorithm IDs for equality.
      boolean equals​(AlgorithmId other)
      Returns true iff the argument indicates the same algorithm with the same parameters.
      static AlgorithmId get​(java.lang.String algname)
      Returns one of the algorithm IDs most commonly associated with this algorithm name.
      static AlgorithmId getAlgorithmId​(java.lang.String algname)
      Deprecated.
      use the short get form of this method.
      static java.lang.String getDigAlgFromSigAlg​(java.lang.String signatureAlgorithm)
      Extracts the digest algorithm name from a signature algorithm name.
      static java.lang.String getEncAlgFromSigAlg​(java.lang.String signatureAlgorithm)
      Extracts the encryption algorithm name from a signature algorithm name.
      java.lang.String getOID()
      Returns the ISO OID for this algorithm.
      int hashCode()
      Returns a hashcode for this AlgorithmId.
      static java.lang.String makeSigAlg​(java.lang.String digAlg, java.lang.String encAlg)
      Creates a signature algorithm name from a digest algorithm name and a encryption algorithm name.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AlgorithmId

        @Deprecated
        public AlgorithmId()
        Deprecated.
        use one of the other constructors.
        Constructs an algorithm ID which will be initialized separately, for example by deserialization.
      • AlgorithmId

        public AlgorithmId​(java.lang.String oid)
        Constructs a parameterless algorithm ID.
        Parameters:
        oid - the identifier for the algorithm
    • Method Detail

      • getOID

        public final java.lang.String getOID()
        Returns the ISO OID for this algorithm. This is usually converted to a string and used as part of an algorithm name, for example "OID.1.3.14.3.2.13" style notation. Use the getName call when you do not need to ensure cross-system portability of algorithm names, or need a user friendly name.
        Returns:
      • equals

        public boolean equals​(AlgorithmId other)
        Returns true iff the argument indicates the same algorithm with the same parameters.
        Parameters:
        other -
        Returns:
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object other)
        Compares this AlgorithmID to another. If algorithm parameters are available, they are compared. Otherwise, just the object IDs for the algorithm are compared.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - preferably an AlgorithmId, else an ObjectIdentifier
      • equals

        public final boolean equals​(java.lang.String id)
        Compares two algorithm IDs for equality. Returns true iff they are the same algorithm, ignoring algorithm parameters.
      • hashCode

        public int hashCode()
        Returns a hashcode for this AlgorithmId.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hashcode for this AlgorithmId.
      • getAlgorithmId

        @Deprecated
        public static AlgorithmId getAlgorithmId​(java.lang.String algname)
                                          throws NoSuchAlgorithmException
        Deprecated.
        use the short get form of this method.
        Returns one of the algorithm IDs most commonly associated with this algorithm name.
        Parameters:
        algname - the name being used
        Throws:
        NoSuchAlgorithmException - on error.
      • makeSigAlg

        public static java.lang.String makeSigAlg​(java.lang.String digAlg,
                                                  java.lang.String encAlg)
        Creates a signature algorithm name from a digest algorithm name and a encryption algorithm name.
      • getEncAlgFromSigAlg

        public static java.lang.String getEncAlgFromSigAlg​(java.lang.String signatureAlgorithm)
        Extracts the encryption algorithm name from a signature algorithm name.
      • getDigAlgFromSigAlg

        public static java.lang.String getDigAlgFromSigAlg​(java.lang.String signatureAlgorithm)
        Extracts the digest algorithm name from a signature algorithm name.