Enum EC

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

    public enum EC
    extends java.lang.Enum<EC>
    Utility for Elliptic Curve keys.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.security.PrivateKey privateKeyFromPKCS8​(byte[] pkcs8)
      Returns a private key constructed from the given DER bytes in PKCS#8 format.
      static java.security.PublicKey publicKeyFrom​(byte[] derBytes)
      Returns a public key constructed from the given DER bytes.
      static EC valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static EC[] 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
    • Method Detail

      • values

        public static EC[] 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 (EC c : EC.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static EC 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
      • privateKeyFromPKCS8

        public static java.security.PrivateKey privateKeyFromPKCS8​(byte[] pkcs8)
                                                            throws java.security.spec.InvalidKeySpecException
        Returns a private key constructed from the given DER bytes in PKCS#8 format.
        Parameters:
        pkcs8 - DER bytes in PKCS#8 format
        Returns:
        Private key
        Throws:
        java.security.spec.InvalidKeySpecException - if the DER bytes cannot be converted to a private key
      • publicKeyFrom

        public static java.security.PublicKey publicKeyFrom​(byte[] derBytes)
                                                     throws java.security.spec.InvalidKeySpecException
        Returns a public key constructed from the given DER bytes.
        Parameters:
        derBytes - DER bytes
        Returns:
        Public key
        Throws:
        java.security.spec.InvalidKeySpecException - if the DER bytes cannot be converted to a public key