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
-
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 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(java.util.Date startDate, java.util.Date expirationDate, java.lang.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, 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.NoSuchProviderException
java.security.NoSuchAlgorithmException
java.security.InvalidAlgorithmParameterException
org.bouncycastle.operator.OperatorCreationException
java.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.CertificateEncodingException
java.security.InvalidKeyException
java.lang.IllegalStateException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException
java.security.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 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.SignatureException
java.io.IOException
-
-