public class NetscapeCertType extends V3Extension
NetscapeCertType
Extension.
Each Netscape certificate extension is associated with a specific
certificateExtension
object identifier, derived from:
netscape OBJECT IDENTIFIER ::= { 2 16 840 1 113730 } netscape-cert-extension OBJECT IDENTIFIER :: = { netscape 1 }
The object identifier for the NetscapeCertType
extension
is defined as:
netscape-cert-type OBJECT IDENTIFIER ::= { netscape-cert-extension 1 }
which corresponds to the OID string "2.16.840.1.113730.1.1".
The
Netscape Certificate Specification specifies the NetscapeCertType
extension for limting the applications for a certificate. If the extension exists
in a certificate, it will limit the uses of the certificate to those specified.
If the extension is not present, the certificate can be used for all applications
except Object Signing.
The value is a bit-string, where the individual bit positions are defined as:
You may specify some certificate usage type(s) directly when creating a
NetscapeCertType
extension, or you may use the default constructor
and supply the type(s) by using the setCertType
method, e.g.:
NetscapeCertType netscapeCertType = new NetscapeCertType(); netscapeCertType.setCertType(NetscapeCertType.SSL_CLIENT | NetscapeCertType.SSL_SERVER);
V3Extension
,
X509Extensions
Modifier and Type | Field and Description |
---|---|
static int |
OBJECT_SIGNING
Indicates a certificate that is certified for signing objects such as Java applets
ans plugins.
|
static int |
OBJECT_SIGNING_CA
Indicates a certificate that is certified for issuing certs for Object Signing.
|
static ObjectID |
oid
The object ID of the X.509 extension NetscapeCertType.
|
static int |
S_MIME
Indicates a certificate that is certified for use by clients.
|
static int |
S_MIME_CA
Indicates a certificate that is certified for issuing certs for S/MIME use.
|
static int |
SSL_CA
Indicates a certificate that is certified for issuing certs for SSL use.
|
static int |
SSL_CLIENT
Indicates a certificate that is certified for SSL client authentication use.
|
static int |
SSL_SERVER
Indicates a certificate that is certified for SSL server authentication use.
|
critical
Constructor and Description |
---|
NetscapeCertType()
Default constructor.
|
NetscapeCertType(int type)
Constructs a
NetscapeCertType extension with a specified type parameter. |
Modifier and Type | Method and Description |
---|---|
int |
getCertType()
Returns the usage type value of the certificate as an integer.
|
ObjectID |
getObjectID()
Returns the object ID of this
NetscapeCertType extension |
int |
hashCode()
Returns a hashcode for this identity.
|
void |
init(ASN1Object obj)
Inits this
NetscapeCertType implementation with an ASN1object
representing the value of this extension. |
void |
setCertType(int type)
Sets the usage type of the certificate.
|
ASN1Object |
toASN1Object()
Returns an ASN1Object representing the value of this
NetscapeCertType
extension object. |
java.lang.String |
toString()
Returns a string that represents the contents of this
NetscapeCertType extension. |
getName, isCritical, setCritical
public static final ObjectID oid
public static final int SSL_CLIENT
public static final int SSL_SERVER
public static final int S_MIME
public static final int OBJECT_SIGNING
public static final int SSL_CA
public static final int S_MIME_CA
public static final int OBJECT_SIGNING_CA
public NetscapeCertType()
NetscapeCertType
object.
Use the setCertType
method for explicitly setting
some particular certificate type(s), e.g.:
NetscapeCertType netscapeCertType = new NetscapeCertType(); netscapeCertType.setCertType(NetscapeCertType.SSL_CLIENT | NetscapeCertType.SSL_SERVER);
public NetscapeCertType(int type)
NetscapeCertType
extension with a specified type parameter.
For instance:
NetscapeCertType netscapeCertType = new NetscapeCertType(NetscapeCertType.SSL_CLIENT | NetscapeCertType.SSL_SERVER);
The following types are supported:
type
- the usage type of the certificatepublic ObjectID getObjectID()
NetscapeCertType
extensiongetObjectID
in class V3Extension
public void init(ASN1Object obj)
NetscapeCertType
implementation with an ASN1object
representing the value of this extension.
The ASN1Object represents a BIT STRING which specifies the particular type(s) of certificate usage.
The given ASN1Object is the one created by toASN1Object()
.
This method is used by the X509Extensions
class when parsing the ASN.1 representation
of a certificate for properly initializing an included
NetscapeCertType extension. This method initializes the
extension only with its value, but not with its critical
specification. For that reason, this method shall not be
explicitly called by an application.
init
in class V3Extension
obj
- the NetscapeCertType as ASN1Objectpublic ASN1Object toASN1Object()
NetscapeCertType
extension object.
The returned ASN1Object represents a BIT STRING which specifies the particular type(s) of certificate usage.
toASN1Object
in class V3Extension
NetscapeCertType
as ASN1Objectpublic void setCertType(int type)
For instance:
NetscapeCertType netscapeCertType = new NetscapeCertType(); netscapeCertType.setCertType(NetscapeCertType.SSL_CLIENT | NetscapeCertType.SSL_SERVER);
The following types are supported:
type
- the type of the certificatepublic int getCertType()
Note the "little endian" representation of the BIT STRING representing the
value of this NetscapeCertType
extension: the most significant
bit indicates the type with the lowest bit value, meaning that the integer
value 128 (binary 10000000, hexadecimal 80) specifies the "SSL_CLIENT" type,
and the integer value 1 specifies the "OBJECT_SIGNING_CA" type.
int
public int hashCode()
hashCode
in class V3Extension
public java.lang.String toString()
NetscapeCertType
extension.toString
in class java.lang.Object