Class NSCertTypeExtension

java.lang.Object
org.mozilla.jss.netscape.security.x509.Extension
org.mozilla.jss.netscape.security.extensions.NSCertTypeExtension
All Implemented Interfaces:
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$
See Also:
  • Field Details

  • Constructor Details

    • 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 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:
      IOException
    • NSCertTypeExtension

      public NSCertTypeExtension(byte[] bitString) throws IOException
      Throws:
      IOException
    • NSCertTypeExtension

      public NSCertTypeExtension(Boolean critical, Object value) throws 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:
      IOException - on error.
    • NSCertTypeExtension

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

    • getPosition

      private static int getPosition(String name) throws CertificateException
      Throws:
      CertificateException
    • encodeThis

      private void encodeThis() throws IOException
      Throws:
      IOException
    • 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(String name, Object obj) throws 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:
      CertificateException - on attribute handling errors.
    • get

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

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

      public 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(InputStream in) throws IOException
      Decode the extension from the InputStream.
      Specified by:
      decode in interface CertAttrSet
      Parameters:
      in - the InputStream to unmarshal the contents from.
      Throws:
      IOException - on decoding or validity errors.
    • encode

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

      public Enumeration<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 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(String[] argv)