Package org.tomitribe.auth.signatures
Enum RSA
- java.lang.Object
-
- java.lang.Enum<RSA>
-
- org.tomitribe.auth.signatures.RSA
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.security.PrivateKeyprivateKeyFromPKCS1(byte[] pkcs1)Returns a private key constructed from the given DER bytes in PKCS#1 format.static java.security.PrivateKeyprivateKeyFromPKCS8(byte[] pkcs8)Returns a private key constructed from the given DER bytes in PKCS#8 format.static java.security.PublicKeypublicKeyFrom(byte[] derBytes)Returns a public key constructed from the given DER bytes.static RSAvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static RSA[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Method Detail
-
values
public static RSA[] 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 (RSA c : RSA.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static RSA 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 namejava.lang.NullPointerException- if the argument is null
-
privateKeyFromPKCS8
public static java.security.PrivateKey privateKeyFromPKCS8(byte[] pkcs8) throws java.security.spec.InvalidKeySpecExceptionReturns 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 DER bytes cannot be converted to a private key
-
privateKeyFromPKCS1
public static java.security.PrivateKey privateKeyFromPKCS1(byte[] pkcs1) throws java.security.spec.InvalidKeySpecExceptionReturns a private key constructed from the given DER bytes in PKCS#1 format.- Parameters:
pkcs1- DER bytes in PKCS#1 format- Returns:
- Private Key
- Throws:
java.security.spec.InvalidKeySpecException- if DER bytes cannot be converted to a private key
-
publicKeyFrom
public static java.security.PublicKey publicKeyFrom(byte[] derBytes) throws java.security.spec.InvalidKeySpecExceptionReturns a public key constructed from the given DER bytes.- Parameters:
derBytes- DER bytes to use to construct a public key- Returns:
- Public Key
- Throws:
java.security.spec.InvalidKeySpecException- if the DER bytes cannot be converted to a public key
-
-