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[]Ed25519Prefixprotected static byte[]Ed448Prefix-
Fields inherited from class io.jans.as.model.crypto.KeyFactory
DEF_BC
-
-
Constructor Summary
Constructors Constructor Description EDDSAKeyFactory(SignatureAlgorithm signatureAlgorithm, java.lang.String dnName)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EDDSAPrivateKeycreateEDDSAPrivateKeyFromDecodedKey(SignatureAlgorithm signatureAlgorithm, byte[] decodedPrivateKey, byte[] decodedPublicKey)Creates EDDSA private key from decoded arraystatic EDDSAPublicKeycreateEDDSAPublicKeyFromDecodedKey(SignatureAlgorithm signatureAlgorithm, byte[] decodedPublicKey)Creates EDDSA public key from decoded arrayCertificategenerateV3Certificate(java.util.Date startDate, java.util.Date expirationDate, java.lang.String dnName)Generates certificate X509 v3CertificategetCertificate()Returns X509 CertificateEDDSAPrivateKeygetPrivateKey()Returns EDDSA Private KeyEDDSAPublicKeygetPublicKey()Returns EDDSA Public Key-
Methods inherited from class io.jans.as.model.crypto.KeyFactory
getKey
-
-
-
-
Constructor Detail
-
EDDSAKeyFactory
public EDDSAKeyFactory(SignatureAlgorithm signatureAlgorithm, java.lang.String dnName) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, java.security.InvalidAlgorithmParameterException, org.bouncycastle.operator.OperatorCreationException, java.security.cert.CertificateException
Constructor- Parameters:
signatureAlgorithm-dnName-- Throws:
java.security.NoSuchProviderExceptionjava.security.NoSuchAlgorithmExceptionjava.security.InvalidAlgorithmParameterExceptionorg.bouncycastle.operator.OperatorCreationExceptionjava.security.cert.CertificateException
-
-
Method Detail
-
generateV3Certificate
public Certificate generateV3Certificate(java.util.Date startDate, java.util.Date expirationDate, java.lang.String dnName) throws java.security.SignatureException
Generates certificate X509 v3- Parameters:
startDate-expirationDate-dnName-- Returns:
- Throws:
java.security.cert.CertificateEncodingExceptionjava.security.InvalidKeyExceptionjava.lang.IllegalStateExceptionjava.security.NoSuchProviderExceptionjava.security.NoSuchAlgorithmExceptionjava.security.SignatureException
-
getPrivateKey
public EDDSAPrivateKey getPrivateKey()
Returns EDDSA Private Key- Specified by:
getPrivateKeyin classKeyFactory<EDDSAPrivateKey,EDDSAPublicKey>
-
getPublicKey
public EDDSAPublicKey getPublicKey()
Returns EDDSA Public Key- Specified by:
getPublicKeyin classKeyFactory<EDDSAPrivateKey,EDDSAPublicKey>
-
getCertificate
public Certificate getCertificate()
Returns X509 Certificate- Specified by:
getCertificatein classKeyFactory<EDDSAPrivateKey,EDDSAPublicKey>
-
createEDDSAPublicKeyFromDecodedKey
public static EDDSAPublicKey createEDDSAPublicKeyFromDecodedKey(SignatureAlgorithm signatureAlgorithm, byte[] decodedPublicKey) throws java.security.SignatureException
Creates EDDSA public key from decoded array- Parameters:
signatureAlgorithm-decodedPublicKey-- Returns:
- Throws:
java.security.SignatureException
-
createEDDSAPrivateKeyFromDecodedKey
public static EDDSAPrivateKey createEDDSAPrivateKeyFromDecodedKey(SignatureAlgorithm signatureAlgorithm, byte[] decodedPrivateKey, byte[] decodedPublicKey) throws java.security.SignatureException, java.io.IOException
Creates EDDSA private key from decoded array- Parameters:
signatureAlgorithm-decodedPrivateKey-decodedPublicKey-- Returns:
- Throws:
java.security.SignatureExceptionjava.io.IOException
-
-