Enum SignatureAlgorithm

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<SignatureAlgorithm>

    public enum SignatureAlgorithm
    extends java.lang.Enum<SignatureAlgorithm>
    Signature algorithm.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DSA
      DSA algorithm.
      ECDSA
      ECDSA algorithm.
      RSA
      RSA algorithm.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.lang.String keyAlgorithm
      Name of the private key as reported by PrivateKey.
      int minSdkVersion
      Minimum SDK version that allows this signature.
      java.lang.String signatureAlgorithmSuffix
      Suffix appended to digest algorithm to obtain signature algorithm.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static SignatureAlgorithm fromKeyAlgorithm​(java.lang.String keyAlgorithm, int minSdkVersion)
      Obtains the signature algorithm that corresponds to a private key name applicable to a SDK version.
      java.lang.String signatureAlgorithmName​(DigestAlgorithm digestAlgorithm)
      Obtains the name of the signature algorithm when used with a digest algorithm.
      static SignatureAlgorithm valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static SignatureAlgorithm[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • keyAlgorithm

        public final java.lang.String keyAlgorithm
        Name of the private key as reported by PrivateKey.
      • minSdkVersion

        public final int minSdkVersion
        Minimum SDK version that allows this signature.
      • signatureAlgorithmSuffix

        public final java.lang.String signatureAlgorithmSuffix
        Suffix appended to digest algorithm to obtain signature algorithm.
    • Method Detail

      • values

        public static SignatureAlgorithm[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (SignatureAlgorithm c : SignatureAlgorithm.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static SignatureAlgorithm valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • fromKeyAlgorithm

        public static SignatureAlgorithm fromKeyAlgorithm​(java.lang.String keyAlgorithm,
                                                          int minSdkVersion)
                                                   throws java.security.NoSuchAlgorithmException
        Obtains the signature algorithm that corresponds to a private key name applicable to a SDK version.
        Parameters:
        keyAlgorithm - the named referred in the PrivateKey
        minSdkVersion - minimum SDK version to run
        Returns:
        the algorithm that has keyAlgorithm equal to keyAlgorithm
        Throws:
        java.security.NoSuchAlgorithmException - if no algorithm was found for the given private key; an algorithm was found but is not applicable to the given SDK version
      • signatureAlgorithmName

        public java.lang.String signatureAlgorithmName​(DigestAlgorithm digestAlgorithm)
        Obtains the name of the signature algorithm when used with a digest algorithm.
        Parameters:
        digestAlgorithm - the digest algorithm to use
        Returns:
        the name of the signature algorithm