- java.lang.Object
-
- java.security.cert.Certificate
-
- java.security.cert.X509Certificate
-
- io.netty5.handler.ssl.PemX509Certificate
-
- All Implemented Interfaces:
Resource<PemX509Certificate>,Serializable,AutoCloseable,X509Extension
public final class PemX509Certificate extends X509Certificate implements Resource<PemX509Certificate>
This is a special purpose implementation of aX509Certificatewhich allows the user to pass PEM/PKCS#8 encoded data straight intoOpenSslContextwithout having to parse and re-encode bytes in Java land. All methods other than what's implemented inPemEncoded's throwUnsupportedOperationExceptions.- See Also:
PemEncoded,OpenSslContext,valueOf(byte[]),valueOf(Buffer), Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.security.cert.Certificate
Certificate.CertificateRep
-
-
Method Summary
-
Methods inherited from class java.security.cert.X509Certificate
getExtendedKeyUsage, getIssuerAlternativeNames, getIssuerX500Principal, getSubjectAlternativeNames, getSubjectX500Principal, verify
-
Methods inherited from class java.security.cert.Certificate
getType, writeReplace
-
-
-
-
Method Detail
-
valueOf
public static PemX509Certificate valueOf(byte[] key)
Creates aPemX509Certificatefrom rawbyte[]. ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value. No input validation is performed to validate it.
-
valueOf
public static PemX509Certificate valueOf(Buffer key)
Creates aPemX509Certificatefrom rawBuffer. ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value. No input validation is performed to validate it.
-
content
public Buffer content()
-
close
public void close()
Description copied from interface:ResourceClose the resource, making it inaccessible.Note, this method is not thread-safe unless otherwise specified.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceResource<PemX509Certificate>
-
copy
public PemX509Certificate copy()
-
send
public Send<PemX509Certificate> send()
Description copied from interface:ResourceSend this object instance to another Thread, transferring the ownership to the recipient.The object must be in a state where it can be sent, which includes at least being accessible.
When sent, this instance will immediately become inaccessible, as if by closing it. All attempts at accessing an object that has been sent, even if that object has not yet been received, should cause an exception to be thrown.
Calling
Resource.close()on an object that has been sent will have no effect, so this method is safe to call within a try-with-resources statement.- Specified by:
sendin interfaceResource<PemX509Certificate>
-
isAccessible
public boolean isAccessible()
Description copied from interface:ResourceCheck if this object is accessible.- Specified by:
isAccessiblein interfaceResource<PemX509Certificate>- Returns:
trueif this object is still valid and can be accessed, otherwisefalseif, for instance, this object has been dropped/deallocated, or been sent elsewhere.
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncodedin classCertificate
-
hasUnsupportedCriticalExtension
public boolean hasUnsupportedCriticalExtension()
- Specified by:
hasUnsupportedCriticalExtensionin interfaceX509Extension
-
getCriticalExtensionOIDs
public Set<String> getCriticalExtensionOIDs()
- Specified by:
getCriticalExtensionOIDsin interfaceX509Extension
-
getNonCriticalExtensionOIDs
public Set<String> getNonCriticalExtensionOIDs()
- Specified by:
getNonCriticalExtensionOIDsin interfaceX509Extension
-
getExtensionValue
public byte[] getExtensionValue(String oid)
- Specified by:
getExtensionValuein interfaceX509Extension
-
checkValidity
public void checkValidity()
- Specified by:
checkValidityin classX509Certificate
-
checkValidity
public void checkValidity(Date date)
- Specified by:
checkValidityin classX509Certificate
-
getVersion
public int getVersion()
- Specified by:
getVersionin classX509Certificate
-
getSerialNumber
public BigInteger getSerialNumber()
- Specified by:
getSerialNumberin classX509Certificate
-
getIssuerDN
public Principal getIssuerDN()
- Specified by:
getIssuerDNin classX509Certificate
-
getSubjectDN
public Principal getSubjectDN()
- Specified by:
getSubjectDNin classX509Certificate
-
getNotBefore
public Date getNotBefore()
- Specified by:
getNotBeforein classX509Certificate
-
getNotAfter
public Date getNotAfter()
- Specified by:
getNotAfterin classX509Certificate
-
getTBSCertificate
public byte[] getTBSCertificate()
- Specified by:
getTBSCertificatein classX509Certificate
-
getSignature
public byte[] getSignature()
- Specified by:
getSignaturein classX509Certificate
-
getSigAlgName
public String getSigAlgName()
- Specified by:
getSigAlgNamein classX509Certificate
-
getSigAlgOID
public String getSigAlgOID()
- Specified by:
getSigAlgOIDin classX509Certificate
-
getSigAlgParams
public byte[] getSigAlgParams()
- Specified by:
getSigAlgParamsin classX509Certificate
-
getIssuerUniqueID
public boolean[] getIssuerUniqueID()
- Specified by:
getIssuerUniqueIDin classX509Certificate
-
getSubjectUniqueID
public boolean[] getSubjectUniqueID()
- Specified by:
getSubjectUniqueIDin classX509Certificate
-
getKeyUsage
public boolean[] getKeyUsage()
- Specified by:
getKeyUsagein classX509Certificate
-
getBasicConstraints
public int getBasicConstraints()
- Specified by:
getBasicConstraintsin classX509Certificate
-
verify
public void verify(PublicKey key)
- Specified by:
verifyin classCertificate
-
verify
public void verify(PublicKey key, String sigProvider)
- Specified by:
verifyin classCertificate
-
getPublicKey
public PublicKey getPublicKey()
- Specified by:
getPublicKeyin classCertificate
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classCertificate
-
hashCode
public int hashCode()
- Overrides:
hashCodein classCertificate
-
toString
public String toString()
- Specified by:
toStringin classCertificate
-
-