Class CertificateData
java.lang.Object
com.mulesoft.connectors.mcp.api.certificate.CertificateData
- All Implemented Interfaces:
Serializable
A custom Data Transfer Object (DTO) to replace
Certificate,
X509Certificate, and related classes.
This class provides a comprehensive representation of a certificate with various attributes such as type, encoded form,
version, subject and issuer distinguished names, serial number, validity period, public key, signature algorithm details, and
extensions. It implements Serializable to allow its instances to be serialized.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCertificateData(String type, byte[] encoded) Constructs a newCertificateDatainstance with the specified type and encoded form.CertificateData(String type, byte[] encoded, int version, PrincipalData subjectDN, PrincipalData issuerDN, BigInteger serialNumber, Date notBefore, Date notAfter, PublicKeyData publicKey, String sigAlgName, String sigAlgOID, byte[] sigAlgParams, byte[] signature, int basicConstraints, List<String> extendedKeyUsage, boolean[] keyUsage, boolean[] issuerUniqueID, List<AlternativeNameData> subjectAlternativeNames, List<AlternativeNameData> issuerAlternativeNames, List<CertificateExtension> extensions, Set<String> criticalOids, Set<String> nonCriticalOids, boolean hasUnsupportedCriticalExtensions) Constructs a newCertificateDatainstance with detailed attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks if the certificate is currently valid.voidcheckValidity(Date date) Checks if the certificate is valid at the specified date.booleanstatic StringformatSignature(byte[] signature) Formats the signature bytes into a readable string representation.intReturns the basic constraints.Returns the critical extension OIDs.byte[]Returns the encoded form of the certificate.Returns the extended key usage.Returns the certificate extensions.byte[]getExtensionValue(String oid) Returns the value of the extension with the specified OID.Returns the issuer alternative names.Returns the issuer distinguished name.boolean[]Returns the issuer unique ID.Returns the issuer X500 principal.boolean[]Returns the key usage.getName()Returns the name of the subject distinguished name.Returns the non-critical extension OIDs.Returns the end date of the validity period.Returns the start date of the validity period.Returns the public key of the certificate.Returns the serial number of the certificate.Returns the serial number as a SerialNumberData object.Returns the signature algorithm name.Returns the signature algorithm OID.byte[]Returns the signature algorithm parameters.byte[]Returns the signature.Returns the subject alternative names.Returns the subject distinguished name.Returns the subject X500 principal.getType()Returns the type of the certificate.intReturns the version of the certificate.inthashCode()booleanReturns whether the certificate has unsupported critical extensions.toString()
-
Constructor Details
-
CertificateData
Constructs a newCertificateDatainstance with the specified type and encoded form.- Parameters:
type- the type of the certificateencoded- the encoded form of the certificate
-
CertificateData
public CertificateData(String type, byte[] encoded, int version, PrincipalData subjectDN, PrincipalData issuerDN, BigInteger serialNumber, Date notBefore, Date notAfter, PublicKeyData publicKey, String sigAlgName, String sigAlgOID, byte[] sigAlgParams, byte[] signature, int basicConstraints, List<String> extendedKeyUsage, boolean[] keyUsage, boolean[] issuerUniqueID, List<AlternativeNameData> subjectAlternativeNames, List<AlternativeNameData> issuerAlternativeNames, List<CertificateExtension> extensions, Set<String> criticalOids, Set<String> nonCriticalOids, boolean hasUnsupportedCriticalExtensions) Constructs a newCertificateDatainstance with detailed attributes.- Parameters:
type- the type of the certificateencoded- the encoded form of the certificateversion- the version of the certificatesubjectDN- the subject distinguished nameissuerDN- the issuer distinguished nameserialNumber- the serial number of the certificatenotBefore- the start date of the validity periodnotAfter- the end date of the validity periodpublicKey- the public key of the certificatesigAlgName- the signature algorithm namesigAlgOID- the signature algorithm OIDsigAlgParams- the signature algorithm parameterssignature- the signaturebasicConstraints- the basic constraintsextendedKeyUsage- the extended key usagekeyUsage- the key usageissuerUniqueID- the issuer unique IDsubjectAlternativeNames- the subject alternative namesissuerAlternativeNames- the issuer alternative namesextensions- the certificate extensionscriticalOids- the critical OIDsnonCriticalOids- the non-critical OIDshasUnsupportedCriticalExtensions- whether the certificate has unsupported critical extensions
-
-
Method Details
-
getType
Returns the type of the certificate.- Returns:
- the type of the certificate
-
getName
Returns the name of the subject distinguished name.- Returns:
- the name of the subject distinguished name
-
getVersion
public int getVersion()Returns the version of the certificate.- Returns:
- the version of the certificate
-
getSubjectDN
Returns the subject distinguished name.- Returns:
- the subject distinguished name
-
getIssuerDN
Returns the issuer distinguished name.- Returns:
- the issuer distinguished name
-
getSubjectX500Principal
Returns the subject X500 principal.- Returns:
- the subject X500 principal
-
getIssuerX500Principal
Returns the issuer X500 principal.- Returns:
- the issuer X500 principal
-
getSerialNumber
Returns the serial number of the certificate.- Returns:
- the serial number of the certificate
-
getSerialNumberObject
Returns the serial number as a SerialNumberData object.- Returns:
- the serial number as a SerialNumberData object
-
getNotBefore
Returns the start date of the validity period.- Returns:
- the start date of the validity period
-
getNotAfter
Returns the end date of the validity period.- Returns:
- the end date of the validity period
-
getPublicKey
Returns the public key of the certificate.- Returns:
- the public key of the certificate
-
getSigAlgName
Returns the signature algorithm name.- Returns:
- the signature algorithm name
-
getSigAlgOID
Returns the signature algorithm OID.- Returns:
- the signature algorithm OID
-
getSigAlgParams
public byte[] getSigAlgParams()Returns the signature algorithm parameters.- Returns:
- the signature algorithm parameters
-
getSignature
public byte[] getSignature()Returns the signature.- Returns:
- the signature
-
getBasicConstraints
public int getBasicConstraints()Returns the basic constraints.- Returns:
- the basic constraints
-
getExtendedKeyUsage
Returns the extended key usage.- Returns:
- the extended key usage
-
getKeyUsage
public boolean[] getKeyUsage()Returns the key usage.- Returns:
- the key usage
-
getSubjectAlternativeNames
Returns the subject alternative names.- Returns:
- the subject alternative names
-
getIssuerAlternativeNames
Returns the issuer alternative names.- Returns:
- the issuer alternative names
-
getExtensions
Returns the certificate extensions.- Returns:
- the certificate extensions
-
getExtensionValue
Returns the value of the extension with the specified OID.- Parameters:
oid- the OID of the extension- Returns:
- the value of the extension
-
getCriticalExtensionOIDs
Returns the critical extension OIDs.- Returns:
- the critical extension OIDs
-
getNonCriticalExtensionOIDs
Returns the non-critical extension OIDs.- Returns:
- the non-critical extension OIDs
-
hasUnsupportedCriticalExtension
public boolean hasUnsupportedCriticalExtension()Returns whether the certificate has unsupported critical extensions.- Returns:
trueif the certificate has unsupported critical extensions;falseotherwise
-
getIssuerUniqueID
public boolean[] getIssuerUniqueID()Returns the issuer unique ID.- Returns:
- the issuer unique ID
-
checkValidity
Checks if the certificate is currently valid.- Throws:
CertificateExpiredException- if the certificate has expiredCertificateNotYetValidException- if the certificate is not yet valid
-
checkValidity
public void checkValidity(Date date) throws CertificateExpiredException, CertificateNotYetValidException Checks if the certificate is valid at the specified date.- Parameters:
date- the date to check the validity against- Throws:
CertificateExpiredException- if the certificate has expiredCertificateNotYetValidException- if the certificate is not yet valid
-
hashCode
public int hashCode() -
equals
-
toString
-
formatSignature
Formats the signature bytes into a readable string representation.- Parameters:
signature- the signature bytes- Returns:
- a formatted string representation of the signature
-
getEncoded
Returns the encoded form of the certificate.- Returns:
- the encoded form of the certificate
- Throws:
CertificateEncodingException- if encoding fails
-