- 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 aX509Certificate
which allows the user to pass PEM/PKCS#8 encoded data straight intoOpenSslContext
without having to parse and re-encode bytes in Java land. All methods other than what's implemented inPemEncoded
's throwUnsupportedOperationException
s.- 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 aPemX509Certificate
from 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 aPemX509Certificate
from 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:Resource
Close the resource, making it inaccessible.Note, this method is not thread-safe unless otherwise specified.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceResource<PemX509Certificate>
-
copy
public PemX509Certificate copy()
-
send
public Send<PemX509Certificate> send()
Description copied from interface:Resource
Send 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:
send
in interfaceResource<PemX509Certificate>
-
isAccessible
public boolean isAccessible()
Description copied from interface:Resource
Check if this object is accessible.- Specified by:
isAccessible
in interfaceResource<PemX509Certificate>
- Returns:
true
if this object is still valid and can be accessed, otherwisefalse
if, for instance, this object has been dropped/deallocated, or been sent elsewhere.
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncoded
in classCertificate
-
hasUnsupportedCriticalExtension
public boolean hasUnsupportedCriticalExtension()
- Specified by:
hasUnsupportedCriticalExtension
in interfaceX509Extension
-
getCriticalExtensionOIDs
public Set<String> getCriticalExtensionOIDs()
- Specified by:
getCriticalExtensionOIDs
in interfaceX509Extension
-
getNonCriticalExtensionOIDs
public Set<String> getNonCriticalExtensionOIDs()
- Specified by:
getNonCriticalExtensionOIDs
in interfaceX509Extension
-
getExtensionValue
public byte[] getExtensionValue(String oid)
- Specified by:
getExtensionValue
in interfaceX509Extension
-
checkValidity
public void checkValidity()
- Specified by:
checkValidity
in classX509Certificate
-
checkValidity
public void checkValidity(Date date)
- Specified by:
checkValidity
in classX509Certificate
-
getVersion
public int getVersion()
- Specified by:
getVersion
in classX509Certificate
-
getSerialNumber
public BigInteger getSerialNumber()
- Specified by:
getSerialNumber
in classX509Certificate
-
getIssuerDN
public Principal getIssuerDN()
- Specified by:
getIssuerDN
in classX509Certificate
-
getSubjectDN
public Principal getSubjectDN()
- Specified by:
getSubjectDN
in classX509Certificate
-
getNotBefore
public Date getNotBefore()
- Specified by:
getNotBefore
in classX509Certificate
-
getNotAfter
public Date getNotAfter()
- Specified by:
getNotAfter
in classX509Certificate
-
getTBSCertificate
public byte[] getTBSCertificate()
- Specified by:
getTBSCertificate
in classX509Certificate
-
getSignature
public byte[] getSignature()
- Specified by:
getSignature
in classX509Certificate
-
getSigAlgName
public String getSigAlgName()
- Specified by:
getSigAlgName
in classX509Certificate
-
getSigAlgOID
public String getSigAlgOID()
- Specified by:
getSigAlgOID
in classX509Certificate
-
getSigAlgParams
public byte[] getSigAlgParams()
- Specified by:
getSigAlgParams
in classX509Certificate
-
getIssuerUniqueID
public boolean[] getIssuerUniqueID()
- Specified by:
getIssuerUniqueID
in classX509Certificate
-
getSubjectUniqueID
public boolean[] getSubjectUniqueID()
- Specified by:
getSubjectUniqueID
in classX509Certificate
-
getKeyUsage
public boolean[] getKeyUsage()
- Specified by:
getKeyUsage
in classX509Certificate
-
getBasicConstraints
public int getBasicConstraints()
- Specified by:
getBasicConstraints
in classX509Certificate
-
verify
public void verify(PublicKey key)
- Specified by:
verify
in classCertificate
-
verify
public void verify(PublicKey key, String sigProvider)
- Specified by:
verify
in classCertificate
-
getPublicKey
public PublicKey getPublicKey()
- Specified by:
getPublicKey
in classCertificate
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classCertificate
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classCertificate
-
toString
public String toString()
- Specified by:
toString
in classCertificate
-
-