public class LunaCertificateX509 extends X509Certificate implements LunaCertificate
Certificate.CertificateRep| Modifier | Constructor and Description |
|---|---|
|
LunaCertificateX509(byte[] certEncoding)
Create a LunaCertificateX509 object from the given DER encoding.
|
|
LunaCertificateX509(byte[] certEncoding,
int slot)
Create a LunaCertificateX509 object from the given DER encoding.
|
protected |
LunaCertificateX509(LunaTokenObject object)
Define a LunaCertificateX509 object from a certificate stored on Luna hardware.
|
protected |
LunaCertificateX509(LunaTokenObject obj,
com.safenetinc.luna.X509.AsnCertificate cert)
Used by the factory methods to create a LunaCert when we've already retrieved/created the token object and
certificate.
|
|
LunaCertificateX509(X509Certificate cert)
Create a LunaCertificateX509 object and initialize it using values from the given certificate.
|
|
LunaCertificateX509(X509Certificate cert,
int slot)
Create a LunaCertificateX509 object and initialize it using values from the given certificate.
|
| Modifier and Type | Method and Description |
|---|---|
void |
checkValidity()
Checks that the certificate is currently valid.
|
void |
checkValidity(Date date)
Checks that the given date is within the certificate's validity period.
|
void |
DestroyCert()
Destroy the certificate object and remove it from the token.
|
int |
getBasicConstraints()
Gets the certificate constraints path length from the critical BasicConstraints extension, (OID = 2.5.29.19).
|
protected static String |
GetCertChainEntryName(String alias,
int index) |
protected int |
GetCertHandle() |
Set<String> |
getCriticalExtensionOIDs()
Gets a Set of the OID strings for the extension(s) marked CRITICAL.
|
Date |
GetDateMadePersistent() |
byte[] |
getEncoded()
Retrieve the encoding of the certificate.
|
List<String> |
getExtendedKeyUsage()
Gets a list of extended key usage details
|
byte[] |
getExtensionValue(String oid)
Gets the DER-encoded OCTET string for the extension value (extnValue) identified by the passed-in oid String.
|
byte[] |
GetFingerprint() |
Principal |
getIssuerDN()
Deprecated.
This method has been denigrated by SUN as of Java 5.0. Use
getIssuerX500Principal()
instead.
CANNOT REMOVE THIS : X509Certificate DECLARES IT ABSTRACT, SO MUST IMPLEMENT. |
boolean[] |
getIssuerUniqueID()
Gets the issuerUniqueID value from the certificate.
|
X500Principal |
getIssuerX500Principal()
Gets the issuer distinguished name from the certificate.
|
boolean[] |
getKeyUsage()
Gets a boolean array representing bits of the KeyUsage extension, (OID = 2.5.29.15).
|
Set<String> |
getNonCriticalExtensionOIDs()
Gets a Set of the OID strings for the extension(s) marked NON-CRITICAL.
|
Date |
getNotAfter()
Gets the notAfter date from the validity period of the certificate.
|
Date |
getNotBefore()
Gets the notBefore date from the validity period of the certificate.
|
PublicKey |
getPublicKey()
Gets the public key from this certificate.
|
BigInteger |
getSerialNumber()
Gets the serialNumber value from the certificate.
|
String |
getSigAlgName()
Gets the signature algorithm name for the certificate signature algorithm.
|
String |
getSigAlgOID()
Gets the signature algorithm OID string from the certificate.
|
byte[] |
getSigAlgParams()
Gets the DER-encoded signature algorithm parameters from this certificate's signature algorithm.
|
byte[] |
getSignature()
Gets the signature value (the raw signature bits) from the certificate.
|
Principal |
getSubjectDN()
Deprecated.
This method has been denigrated by SUN as of Java 5.0. Use
getSubjectX500Principal()
instead.
CANNOT REMOVE THIS : X509Certificate DECLARES IT ABSTRACT, SO MUST IMPLEMENT. |
boolean[] |
getSubjectUniqueID()
Gets the subjectUniqueID value from the certificate.
|
X500Principal |
getSubjectX500Principal() |
byte[] |
getTBSCertificate()
Gets the DER-encoded certificate information, the tbsCertificate from this certificate.
|
int |
getVersion()
Gets the version (version number) value from the certificate.
|
boolean |
hasUnsupportedCriticalExtension()
Check if there is a critical extension that is not supported.
|
boolean |
IsCertPersistent() |
static LunaCertificateX509 |
LocateCertByAlias(String alias)
Create a LunaCertificateX509 object by searching the default token for a certificate with the given alias.
|
static LunaCertificateX509 |
LocateCertByAlias(String alias,
int slot)
Create a LunaCertificateX509 object by searching the specified token for a certificate with the given alias.
|
static LunaCertificateX509 |
LocateCertByHandle(int handle)
Locate a certificate on the default slot by using the object handle.
|
static LunaCertificateX509 |
LocateCertByHandle(int handle,
int slot)
Locate a certificate on the specified slot by using the object handle.
|
void |
MakePersistent(String alias)
Store a LunaCertificateX509 on a Luna token
|
static LunaCertificateX509 |
SelfSign(KeyPair kp,
String subject,
BigInteger serialNumber,
Date notBefore,
Date notAfter)
Create a LunaCertificateX509 on the default slot by self-signing a key pair.
|
static LunaCertificateX509 |
SelfSign(KeyPair kp,
String subject,
BigInteger serialNumber,
Date notBefore,
Date notAfter,
int slot)
Create a LunaCertificateX509 on the specified slot by self-signing a key pair.
|
static LunaCertificateX509 |
SelfSign(String algorithm,
KeyPair kp,
String subject,
BigInteger serialNumber,
Date notBefore,
Date notAfter,
int pssSaltValue)
Create a LunaCertificateX509 in the default slot by self-signing a key pair.
|
static LunaCertificateX509 |
SelfSign(String algorithm,
KeyPair kp,
String subject,
BigInteger serialNumber,
Date notBefore,
Date notAfter,
int pssSaltValue,
int slot)
Create a LunaCertificateX509 in the specified slot by self-signing a key pair.
|
String |
toString()
Retrieve a (short) string representation of the object
|
void |
verify(PublicKey key)
Verifies that this certificate was signed using the private key that corresponds to the specified public key.
|
void |
verify(PublicKey key,
String sigProvider)
Verifies that this certificate was signed using the private key that corresponds to the specified public key.
|
getIssuerAlternativeNames, getSubjectAlternativeNamesequals, getType, hashCode, writeReplacepublic LunaCertificateX509(X509Certificate cert) throws CertificateEncodingException
The resulting certificate is stored on the Luna hardware on the currently set default token, although it will not be persistent until it is stored in a LunaKeyStore or the MakePersistent() method is invoked.
cert - The certificate from which the LunaCertificateX509 object is derived.CertificateEncodingException - exceptionpublic LunaCertificateX509(X509Certificate cert, int slot) throws CertificateEncodingException
The resulting certificate is stored on the Luna hardware on the token in the specified slot, although it will not be persistent until it is stored in a LunaKeyStore or the MakePersistent() method is invoked.
cert - The certificate from which the LunaCertificateX509 object is derived.slot - slot numberCertificateEncodingException - exceptionpublic LunaCertificateX509(byte[] certEncoding)
The resulting certificate is stored on the Luna hardware on the currently set default token, although it will not be persistent until it is stored in a LunaKeyStore or the MakePersistent() method is invoked.
certEncoding - The DER encoding of a certificate.public LunaCertificateX509(byte[] certEncoding,
int slot)
The resulting certificate is stored on the Luna hardware on the token in the specified slot, although it will not be persistent until it is stored in a LunaKeyStore or the MakePersistent() method is invoked.
certEncoding - The DER encoding of a certificate.slot - slot numberprotected LunaCertificateX509(LunaTokenObject object)
object - generic Luna objectprotected LunaCertificateX509(LunaTokenObject obj, com.safenetinc.luna.X509.AsnCertificate cert)
obj - generic Luna objectcert - ASN-encoded certificatepublic static LunaCertificateX509 SelfSign(String algorithm, KeyPair kp, String subject, BigInteger serialNumber, Date notBefore, Date notAfter, int pssSaltValue) throws InvalidKeyException, CertificateEncodingException
Accepts an RSA, DSA or ECDSA key pair and creates a self-signed certificate from them.
algorithm - The algorithm to use for the signaturekp - The key pair.subject - The distinguished name for the subject and issuerserialNumber - The serial number of the certificatenotBefore - The notBefore date of the certificatenotAfter - The notAfter date of the certificatepssSaltValue - Salt value used if a PSS algorthm is specifiedInvalidKeyException - if the key pair is not RSA or DSA.CertificateEncodingException - if we have problems encoding the certificate.public static LunaCertificateX509 SelfSign(String algorithm, KeyPair kp, String subject, BigInteger serialNumber, Date notBefore, Date notAfter, int pssSaltValue, int slot) throws InvalidKeyException, CertificateEncodingException
Accepts an RSA, DSA or ECDSA key pair and creates a self-signed certificate from them.
algorithm - The algorithm to use for the signaturekp - The key pair.subject - The distinguished name for the subject and issuerserialNumber - The serial number of the certificatenotBefore - The notBefore date of the certificatenotAfter - The notAfter date of the certificatepssSaltValue - Salt value used if a PSS algorthm is specifiedslot - slot numberInvalidKeyException - if the key pair is not RSA or DSA.CertificateEncodingException - if we have problems encoding the certificate.public static LunaCertificateX509 SelfSign(KeyPair kp, String subject, BigInteger serialNumber, Date notBefore, Date notAfter) throws InvalidKeyException, CertificateEncodingException
Accepts an RSA, DSA or ECDSA key pair and creates a self-signed certificate from them. If the key pair is RSA, SHA1withRSA is used as the signature algorithm. If the key pair is DSA, SHA1withDSA is used. If the key pair is ECDSA, SHA1withECDSA is used.
kp - The key pairsubject - The distinguished name for the subject and issuerserialNumber - The serial number of the certificatenotBefore - the notBefore date of the certificatenotAfter - the notAfter date of the certificateInvalidKeyException - Returned if the key pair is not RSA or DSACertificateEncodingException - Returned if there are problems encoding the certificatepublic static LunaCertificateX509 SelfSign(KeyPair kp, String subject, BigInteger serialNumber, Date notBefore, Date notAfter, int slot) throws InvalidKeyException, CertificateEncodingException
Accepts an RSA, DSA or ECDSA key pair and creates a self-signed certificate from them. If the key pair is RSA, SHA1withRSA is used as the signature algorithm. If the key pair is DSA, SHA1withDSA is used. If the key pair is ECDSA, SHA1withECDSA is used.
kp - The key pairsubject - The distinguished name for the subject and issuerserialNumber - The serial number of the certificatenotBefore - the notBefore date of the certificatenotAfter - the notAfter date of the certificateslot - slot numberInvalidKeyException - Returned if the key pair is not RSA, DSA or ECDSACertificateEncodingException - Returned if there are problems encoding the certificatepublic static LunaCertificateX509 LocateCertByAlias(String alias)
alias - The alias of the certificate to search forpublic static LunaCertificateX509 LocateCertByAlias(String alias, int slot)
alias - The alias of the certificate to search forslot - The slot to searchpublic static LunaCertificateX509 LocateCertByHandle(int handle)
handle - The handle of the certificate to retrievepublic static LunaCertificateX509 LocateCertByHandle(int handle, int slot)
handle - The handle of the certificate to retrieveslot - The slot the certificate lives onLunaException - if the handle does not point to a certificate object on the HSMpublic byte[] getEncoded()
throws CertificateEncodingException
getEncoded in class CertificateCertificateEncodingExceptionpublic String toString()
toString in class Certificatepublic void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify in class CertificateCertificateExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionNoSuchProviderExceptionSignatureExceptionpublic void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
verify in class CertificateCertificateExceptionNoSuchAlgorithmExceptionInvalidKeyExceptionNoSuchProviderExceptionSignatureExceptionpublic PublicKey getPublicKey()
getPublicKey in class Certificatepublic void checkValidity()
throws CertificateExpiredException,
CertificateNotYetValidException
checkValidity in class X509CertificateCertificateExpiredExceptionCertificateNotYetValidExceptionpublic void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException
checkValidity in class X509CertificateCertificateExpiredExceptionCertificateNotYetValidExceptionpublic int getBasicConstraints()
getBasicConstraints in class X509Certificate@Deprecated public Principal getIssuerDN()
getIssuerX500Principal()
instead.
CANNOT REMOVE THIS : X509Certificate DECLARES IT ABSTRACT, SO MUST IMPLEMENT.getIssuerDN in class X509Certificatepublic X500Principal getIssuerX500Principal()
getIssuerX500Principal in class X509CertificateX509Certificate.getIssuerX500Principal()public boolean[] getIssuerUniqueID()
getIssuerUniqueID in class X509Certificatepublic boolean[] getKeyUsage()
getKeyUsage in class X509Certificatepublic List<String> getExtendedKeyUsage()
getExtendedKeyUsage in class X509Certificatepublic Date getNotAfter()
getNotAfter in class X509Certificatepublic Date getNotBefore()
getNotBefore in class X509Certificatepublic BigInteger getSerialNumber()
getSerialNumber in class X509Certificatepublic String getSigAlgName()
getSigAlgName in class X509Certificatepublic String getSigAlgOID()
getSigAlgOID in class X509Certificatepublic byte[] getSigAlgParams()
getSigAlgParams in class X509Certificatepublic byte[] getSignature()
getSignature in class X509Certificate@Deprecated public Principal getSubjectDN()
getSubjectX500Principal()
instead.
CANNOT REMOVE THIS : X509Certificate DECLARES IT ABSTRACT, SO MUST IMPLEMENT.getSubjectDN in class X509Certificatepublic X500Principal getSubjectX500Principal()
getSubjectX500Principal in class X509Certificatepublic boolean[] getSubjectUniqueID()
getSubjectUniqueID in class X509Certificatepublic byte[] getTBSCertificate()
throws CertificateEncodingException
getTBSCertificate in class X509CertificateCertificateEncodingExceptionpublic int getVersion()
getVersion in class X509Certificatepublic byte[] getExtensionValue(String oid)
getExtensionValue in interface X509Extensionpublic Set<String> getNonCriticalExtensionOIDs()
getNonCriticalExtensionOIDs in interface X509Extensionpublic Set<String> getCriticalExtensionOIDs()
getCriticalExtensionOIDs in interface X509Extensionpublic boolean hasUnsupportedCriticalExtension()
hasUnsupportedCriticalExtension in interface X509Extensionprotected int GetCertHandle()
public void MakePersistent(String alias)
alias - The alias to assign to the certificatepublic boolean IsCertPersistent()
public Date GetDateMadePersistent()
public void DestroyCert()
public byte[] GetFingerprint()
Copyright 2014-2018 SafeNet. All rights reserved.