Class PemX509Certificate

  • All Implemented Interfaces:
    ByteBufHolder, ReferenceCounted, java.io.Serializable, java.security.cert.X509Extension

    public final class PemX509Certificate
    extends java.security.cert.X509Certificate
    This is a special purpose implementation of a X509Certificate which allows the user to pass PEM/PKCS#8 encoded data straight into OpenSslContext without having to parse and re-encode bytes in Java land. All methods other than what's implemented in PemEncoded's throw UnsupportedOperationExceptions.
    See Also:
    PemEncoded, OpenSslContext, valueOf(byte[]), valueOf(ByteBuf), Serialized Form
    • Method Detail

      • valueOf

        public static PemX509Certificate valueOf​(byte[] key)
        Creates a PemX509Certificate from raw byte[]. 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​(ByteBuf key)
        Creates a PemX509Certificate from raw ByteBuf. ATTENTION: It's assumed that the given argument is a PEM/PKCS#8 encoded value. No input validation is performed to validate it.
      • isSensitive

        public boolean isSensitive()
      • refCnt

        public int refCnt()
        Description copied from interface: ReferenceCounted
        Returns the reference count of this object. If 0, it means this object has been deallocated.
        Specified by:
        refCnt in interface ReferenceCounted
      • touch

        public PemX509Certificate touch​(java.lang.Object hint)
        Description copied from interface: ReferenceCounted
        Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector.
        Specified by:
        touch in interface ByteBufHolder
        Specified by:
        touch in interface ReferenceCounted
      • release

        public boolean release()
        Description copied from interface: ReferenceCounted
        Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.
        Specified by:
        release in interface ReferenceCounted
        Returns:
        true if and only if the reference count became 0 and this object has been deallocated
      • release

        public boolean release​(int decrement)
        Description copied from interface: ReferenceCounted
        Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.
        Specified by:
        release in interface ReferenceCounted
        Returns:
        true if and only if the reference count became 0 and this object has been deallocated
      • getEncoded

        public byte[] getEncoded()
        Specified by:
        getEncoded in class java.security.cert.Certificate
      • hasUnsupportedCriticalExtension

        public boolean hasUnsupportedCriticalExtension()
        Specified by:
        hasUnsupportedCriticalExtension in interface java.security.cert.X509Extension
      • getCriticalExtensionOIDs

        public java.util.Set<java.lang.String> getCriticalExtensionOIDs()
        Specified by:
        getCriticalExtensionOIDs in interface java.security.cert.X509Extension
      • getNonCriticalExtensionOIDs

        public java.util.Set<java.lang.String> getNonCriticalExtensionOIDs()
        Specified by:
        getNonCriticalExtensionOIDs in interface java.security.cert.X509Extension
      • getExtensionValue

        public byte[] getExtensionValue​(java.lang.String oid)
        Specified by:
        getExtensionValue in interface java.security.cert.X509Extension
      • checkValidity

        public void checkValidity()
        Specified by:
        checkValidity in class java.security.cert.X509Certificate
      • checkValidity

        public void checkValidity​(java.util.Date date)
        Specified by:
        checkValidity in class java.security.cert.X509Certificate
      • getVersion

        public int getVersion()
        Specified by:
        getVersion in class java.security.cert.X509Certificate
      • getSerialNumber

        public java.math.BigInteger getSerialNumber()
        Specified by:
        getSerialNumber in class java.security.cert.X509Certificate
      • getIssuerDN

        public java.security.Principal getIssuerDN()
        Specified by:
        getIssuerDN in class java.security.cert.X509Certificate
      • getSubjectDN

        public java.security.Principal getSubjectDN()
        Specified by:
        getSubjectDN in class java.security.cert.X509Certificate
      • getNotBefore

        public java.util.Date getNotBefore()
        Specified by:
        getNotBefore in class java.security.cert.X509Certificate
      • getNotAfter

        public java.util.Date getNotAfter()
        Specified by:
        getNotAfter in class java.security.cert.X509Certificate
      • getTBSCertificate

        public byte[] getTBSCertificate()
        Specified by:
        getTBSCertificate in class java.security.cert.X509Certificate
      • getSignature

        public byte[] getSignature()
        Specified by:
        getSignature in class java.security.cert.X509Certificate
      • getSigAlgName

        public java.lang.String getSigAlgName()
        Specified by:
        getSigAlgName in class java.security.cert.X509Certificate
      • getSigAlgOID

        public java.lang.String getSigAlgOID()
        Specified by:
        getSigAlgOID in class java.security.cert.X509Certificate
      • getSigAlgParams

        public byte[] getSigAlgParams()
        Specified by:
        getSigAlgParams in class java.security.cert.X509Certificate
      • getIssuerUniqueID

        public boolean[] getIssuerUniqueID()
        Specified by:
        getIssuerUniqueID in class java.security.cert.X509Certificate
      • getSubjectUniqueID

        public boolean[] getSubjectUniqueID()
        Specified by:
        getSubjectUniqueID in class java.security.cert.X509Certificate
      • getKeyUsage

        public boolean[] getKeyUsage()
        Specified by:
        getKeyUsage in class java.security.cert.X509Certificate
      • getBasicConstraints

        public int getBasicConstraints()
        Specified by:
        getBasicConstraints in class java.security.cert.X509Certificate
      • verify

        public void verify​(java.security.PublicKey key)
        Specified by:
        verify in class java.security.cert.Certificate
      • verify

        public void verify​(java.security.PublicKey key,
                           java.lang.String sigProvider)
        Specified by:
        verify in class java.security.cert.Certificate
      • getPublicKey

        public java.security.PublicKey getPublicKey()
        Specified by:
        getPublicKey in class java.security.cert.Certificate
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.security.cert.Certificate
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.security.cert.Certificate
      • toString

        public java.lang.String toString()
        Specified by:
        toString in class java.security.cert.Certificate