Class EDDSAKeyFactory
- java.lang.Object
-
- io.jans.as.model.crypto.KeyFactory<EDDSAPrivateKey,EDDSAPublicKey>
-
- io.jans.as.model.crypto.signature.EDDSAKeyFactory
-
public class EDDSAKeyFactory extends KeyFactory<EDDSAPrivateKey,EDDSAPublicKey>
Factory to create asymmetric Public and Private Keys for the Edwards Curve Digital Signature Algorithm (EDDSA)- Version:
- July 23, 2021
- Author:
- Sergey Manoylo
-
-
Field Summary
Fields Modifier and Type Field Description protected static byte[]
Ed25519Prefix
protected static byte[]
Ed448Prefix
-
Constructor Summary
Constructors Constructor Description EDDSAKeyFactory(SignatureAlgorithm signatureAlgorithm, String dnName)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EDDSAPrivateKey
createEDDSAPrivateKeyFromDecodedKey(SignatureAlgorithm signatureAlgorithm, byte[] decodedPrivateKey, byte[] decodedPublicKey)
Creates EDDSA private key from decoded arraystatic EDDSAPublicKey
createEDDSAPublicKeyFromDecodedKey(SignatureAlgorithm signatureAlgorithm, byte[] decodedPublicKey)
Creates EDDSA public key from decoded arrayCertificate
generateV3Certificate(Date startDate, Date expirationDate, String dnName)
Generates certificate X509 v3Certificate
getCertificate()
Returns X509 CertificateEDDSAPrivateKey
getPrivateKey()
Returns EDDSA Private KeyEDDSAPublicKey
getPublicKey()
Returns EDDSA Public Key-
Methods inherited from class io.jans.as.model.crypto.KeyFactory
getKey
-
-
-
-
Constructor Detail
-
EDDSAKeyFactory
public EDDSAKeyFactory(SignatureAlgorithm signatureAlgorithm, String dnName) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, org.bouncycastle.operator.OperatorCreationException, CertificateException
Constructor- Parameters:
signatureAlgorithm
-dnName
-- Throws:
NoSuchProviderException
NoSuchAlgorithmException
InvalidAlgorithmParameterException
org.bouncycastle.operator.OperatorCreationException
CertificateException
-
-
Method Detail
-
generateV3Certificate
public Certificate generateV3Certificate(Date startDate, Date expirationDate, String dnName) throws SignatureException
Generates certificate X509 v3- Overrides:
generateV3Certificate
in classKeyFactory<EDDSAPrivateKey,EDDSAPublicKey>
- Parameters:
startDate
-expirationDate
-dnName
-- Returns:
- Throws:
CertificateEncodingException
InvalidKeyException
IllegalStateException
NoSuchProviderException
NoSuchAlgorithmException
SignatureException
-
getPrivateKey
public EDDSAPrivateKey getPrivateKey()
Returns EDDSA Private Key- Specified by:
getPrivateKey
in classKeyFactory<EDDSAPrivateKey,EDDSAPublicKey>
-
getPublicKey
public EDDSAPublicKey getPublicKey()
Returns EDDSA Public Key- Specified by:
getPublicKey
in classKeyFactory<EDDSAPrivateKey,EDDSAPublicKey>
-
getCertificate
public Certificate getCertificate()
Returns X509 Certificate- Specified by:
getCertificate
in classKeyFactory<EDDSAPrivateKey,EDDSAPublicKey>
-
createEDDSAPublicKeyFromDecodedKey
public static EDDSAPublicKey createEDDSAPublicKeyFromDecodedKey(SignatureAlgorithm signatureAlgorithm, byte[] decodedPublicKey) throws SignatureException
Creates EDDSA public key from decoded array- Parameters:
signatureAlgorithm
-decodedPublicKey
-- Returns:
- Throws:
SignatureException
-
createEDDSAPrivateKeyFromDecodedKey
public static EDDSAPrivateKey createEDDSAPrivateKeyFromDecodedKey(SignatureAlgorithm signatureAlgorithm, byte[] decodedPrivateKey, byte[] decodedPublicKey) throws SignatureException, IOException
Creates EDDSA private key from decoded array- Parameters:
signatureAlgorithm
-decodedPrivateKey
-decodedPublicKey
-- Returns:
- Throws:
SignatureException
IOException
-
-