Class OSelfSignedCertificate
java.lang.Object
com.orientechnologies.orient.server.security.OSelfSignedCertificate
- Since:
- 24/02/2021
Class developed to generate self-signed certificate
- Author:
- Matteo Bollo (matteo.bollo-at-sap.com)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckCertificate(X509Certificate cert, PublicKey publicKey, Date date) voidvoidstatic KeyPaircomputeKeyPair(String algorithm, int keySize) Generate and Return a key pair.static BigIntegervoidrecompute a new key pair FOR INTERNAL OSelfSignedCertificate class USE.static X509CertificategenerateSelfSignedCertificate(KeyPair keypair, int validity, String ownerFDN, BigInteger certSN) intvoidsetAlgorithm(String algorithm) voidsetCertificateName(String certificateName) voidsetCertificateSN(long certificateSN) voidsetKey_size(int key_size) voidsetOwnerFDN(String ownerFDN) voidsetValidity(int validity)
-
Field Details
-
DEFAULT_CERTIFICATE_ALGORITHM
- See Also:
-
DEFAULT_CERTIFICATE_KEY_SIZE
public static final int DEFAULT_CERTIFICATE_KEY_SIZE- See Also:
-
DEFAULT_CERTIFICATE_VALIDITY
public static final int DEFAULT_CERTIFICATE_VALIDITY- See Also:
-
DEFAULT_CERTIFICATE_OWNER
- See Also:
-
DEFAULT_CERTIFICATE_NAME
- See Also:
-
-
Constructor Details
-
OSelfSignedCertificate
public OSelfSignedCertificate()
-
-
Method Details
-
getAlgorithm
-
setAlgorithm
-
getKey_size
public int getKey_size() -
setKey_size
public void setKey_size(int key_size) -
setValidity
public void setValidity(int validity) -
getCertificateName
-
setCertificateName
-
setCertificateSN
- Throws:
SwitchToDefaultParamsException
-
computeRandomSerialNumber
-
setOwnerFDN
-
computeKeyPair
Generate and Return a key pair.If this KeyPairGenerator has not been initialized explicitly, provider-specific defaults will be used for the size and other (algorithm-specific) values of the generated keys.Our People
This method will computes and returns a new key pair every time it is called.
- Returns:
- a new key pair
- Throws:
NoSuchAlgorithmException- if the algorithm String not match with the supported key generation schemes.
-
generateCertificateKeyPair
public void generateCertificateKeyPair() throws NoSuchAlgorithmException, SwitchToDefaultParamsExceptionrecompute a new key pair FOR INTERNAL OSelfSignedCertificate class USE.This method is functionally equivalent to
computeKeyPair(this.algorithm,this.key_size). It uses the value pair (DEFAULT_CERTIFICATE_ALGORITHM,DEFAULT_CERTIFICATE_KEY_SIZE) if the setted fields are not valid.- Throws:
NoSuchAlgorithmException- if the algorithm String not match with the supported key generation schemes.SwitchToDefaultParamsException
-
getPublicKey
-
composeSelfSignedCertificate
public void composeSelfSignedCertificate() -
generateSelfSignedCertificate
public static X509Certificate generateSelfSignedCertificate(KeyPair keypair, int validity, String ownerFDN, BigInteger certSN) throws CertificateException, IOException, NoSuchAlgorithmException -
getCertificate
- Throws:
CertificateException
-
checkCertificate
public static void checkCertificate(X509Certificate cert, PublicKey publicKey, Date date) throws NoSuchProviderException, CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException -
checkThisCertificate
public void checkThisCertificate() throws NoSuchAlgorithmException, CertificateException, NoSuchProviderException, InvalidKeyException, SignatureException -
getPrivateKey
-