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
-
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 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(Date startDate, Date expirationDate, 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, String dnName) throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException, org.bouncycastle.operator.OperatorCreationException, CertificateException
Constructor- Parameters:
signatureAlgorithm-dnName-- Throws:
NoSuchProviderExceptionNoSuchAlgorithmExceptionInvalidAlgorithmParameterExceptionorg.bouncycastle.operator.OperatorCreationExceptionCertificateException
-
-
Method Detail
-
generateV3Certificate
public Certificate generateV3Certificate(Date startDate, Date expirationDate, String dnName) throws SignatureException
Generates certificate X509 v3- Overrides:
generateV3Certificatein classKeyFactory<EDDSAPrivateKey,EDDSAPublicKey>- Parameters:
startDate-expirationDate-dnName-- Returns:
- Throws:
CertificateEncodingExceptionInvalidKeyExceptionIllegalStateExceptionNoSuchProviderExceptionNoSuchAlgorithmExceptionSignatureException
-
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 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:
SignatureExceptionIOException
-
-