Class NSCertTypeExtension

  • All Implemented Interfaces:
    java.io.Serializable, CertAttrSet

    public class NSCertTypeExtension
    extends Extension
    implements CertAttrSet
    NSCertTypeExtension Represents Netscape Certificate Type Extension

    This deprecated extension, if present, defines both the purpose (e.g., encipherment, signature, certificate signing) and the application (e.g., SSL, S/Mime or Object Signing of the key contained in the certificate.

    Version:
    $Revision$, $Date$
    Author:
    galperin
    See Also:
    Serialized Form
    • Constructor Detail

      • NSCertTypeExtension

        public NSCertTypeExtension​(boolean critical,
                                   boolean[] bits)
        Create NSCertTypeExtension from boolean array. The criticality is set to false.
      • NSCertTypeExtension

        public NSCertTypeExtension​(boolean[] bits)
      • NSCertTypeExtension

        public NSCertTypeExtension​(boolean critical,
                                   byte[] bitString)
                            throws java.io.IOException
        Create a NSCertTypeExtension with the passed bit settings. The criticality is set to false.
        Parameters:
        bitString - the bits to be set for the extension.
        Throws:
        java.io.IOException
      • NSCertTypeExtension

        public NSCertTypeExtension​(byte[] bitString)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • NSCertTypeExtension

        public NSCertTypeExtension​(java.lang.Boolean critical,
                                   java.lang.Object value)
                            throws java.io.IOException
        Create the extension from the passed DER encoded value of the same.
        Parameters:
        critical - true if the extension is to be treated as critical.
        value - Array of DER encoded bytes of the actual value.
        Throws:
        java.io.IOException - on error.
      • NSCertTypeExtension

        public NSCertTypeExtension()
        Create a default key usage.
    • Method Detail

      • isSet

        public boolean isSet​(int position)
        Check if bit is set.
        Parameters:
        position - the position in the bit string to check.
      • set

        public void set​(int position,
                        boolean val)
        Set the bit at the specified position.
      • set

        public void set​(java.lang.String name,
                        java.lang.Object obj)
                 throws java.security.cert.CertificateException
        Set the attribute value.
        Specified by:
        set in interface CertAttrSet
        Parameters:
        name - the name of the attribute (e.g. "x509.info.key")
        obj - the attribute object.
        Throws:
        java.security.cert.CertificateException - on attribute handling errors.
      • get

        public java.lang.Object get​(java.lang.String name)
                             throws java.security.cert.CertificateException
        Get the attribute value.
        Specified by:
        get in interface CertAttrSet
        Parameters:
        name - the name of the attribute to return.
        Throws:
        java.security.cert.CertificateException - on attribute handling errors.
      • delete

        public void delete​(java.lang.String name)
                    throws java.security.cert.CertificateException
        Delete the attribute value.
        Specified by:
        delete in interface CertAttrSet
        Parameters:
        name - the name of the attribute to delete.
        Throws:
        java.security.cert.CertificateException - on attribute handling errors.
      • toString

        public java.lang.String toString()
        Returns a printable representation of the NSCertType.
        Specified by:
        toString in interface CertAttrSet
        Overrides:
        toString in class Extension
        Returns:
        value of this certificate attribute in printable form.
      • decode

        public void decode​(java.io.InputStream in)
                    throws java.io.IOException
        Decode the extension from the InputStream.
        Specified by:
        decode in interface CertAttrSet
        Parameters:
        in - the InputStream to unmarshal the contents from.
        Throws:
        java.io.IOException - on decoding or validity errors.
      • encode

        public void encode​(java.io.OutputStream out)
                    throws java.io.IOException
        Write the extension to the DerOutputStream.
        Specified by:
        encode in interface CertAttrSet
        Parameters:
        out - the DerOutputStream to write the extension to.
        Throws:
        java.io.IOException - on encoding errors.
      • getAttributeNames

        public java.util.Enumeration<java.lang.String> getAttributeNames()
        Return an enumeration of names of attributes existing within this attribute.
        Specified by:
        getAttributeNames in interface CertAttrSet
        Returns:
        an enumeration of the attribute names.
      • getName

        public java.lang.String getName()
        Return the name of this attribute.
        Specified by:
        getName in interface CertAttrSet
        Returns:
        the name of this CertAttrSet.
      • main

        public static void main​(java.lang.String[] argv)