public class

PrivateKeyUsageExtension

extends Extension
implements CertAttrSet<T>
java.lang.Object
   ↳ sun.security.x509.Extension
     ↳ sun.security.x509.PrivateKeyUsageExtension

Class Overview

This class defines the Private Key Usage Extension.

The Private Key Usage Period extension allows the certificate issuer to specify a different validity period for the private key than the certificate. This extension is intended for use with digital signature keys. This extension consists of two optional components notBefore and notAfter. The private key associated with the certificate should not be used to sign objects before or after the times specified by the two components, respectively.

 PrivateKeyUsagePeriod ::= SEQUENCE {
     notBefore  [0]  GeneralizedTime OPTIONAL,
     notAfter   [1]  GeneralizedTime OPTIONAL }
 

Summary

Constants
String IDENT Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.
String NAME Sub attributes name for this CertAttrSet.
String NOT_AFTER
String NOT_BEFORE
[Expand]
Inherited Fields
From class sun.security.x509.Extension
Public Constructors
PrivateKeyUsageExtension(Date notBefore, Date notAfter)
The default constructor for PrivateKeyUsageExtension.
PrivateKeyUsageExtension(Boolean critical, Object value)
Create the extension from the passed DER encoded value.
Public Methods
void delete(String name)
Delete the attribute value.
void encode(OutputStream out)
Write the extension to the OutputStream.
Object get(String name)
Get the attribute value.
Enumeration<String> getElements()
Return an enumeration of names of attributes existing within this attribute.
String getName()
Return the name of this attribute.
void set(String name, Object obj)
Set the attribute value.
String toString()
Return the printable string.
void valid()
Verify that that the current time is within the validity period.
void valid(Date now)
Verify that that the passed time is within the validity period.
[Expand]
Inherited Methods
From class sun.security.x509.Extension
From class java.lang.Object
From interface sun.security.x509.CertAttrSet

Constants

public static final String IDENT

Identifier for this attribute, to be used with the get, set, delete methods of Certificate, x509 type.

Constant Value: "x509.info.extensions.PrivateKeyUsage"

public static final String NAME

Sub attributes name for this CertAttrSet.

Constant Value: "PrivateKeyUsage"

public static final String NOT_AFTER

Constant Value: "not_after"

public static final String NOT_BEFORE

Constant Value: "not_before"

Public Constructors

public PrivateKeyUsageExtension (Date notBefore, Date notAfter)

The default constructor for PrivateKeyUsageExtension.

Parameters
notBefore the date/time before which the private key should not be used.
notAfter the date/time after which the private key should not be used.
Throws
IOException

public PrivateKeyUsageExtension (Boolean critical, Object value)

Create the extension from the passed DER encoded value.

Parameters
critical true if the extension is to be treated as critical.
value an array of DER encoded bytes of the actual value.
Throws
ClassCastException if value is not an array of bytes
CertificateException on certificate parsing errors.
IOException on error.

Public Methods

public void delete (String name)

Delete the attribute value.

Parameters
name the name of the attribute to delete.
Throws
CertificateException on attribute handling errors.
IOException

public void encode (OutputStream out)

Write the extension to the OutputStream.

Parameters
out the OutputStream to write the extension to.
Throws
IOException on encoding errors.

public Object get (String name)

Get the attribute value.

Parameters
name the name of the attribute to return.
Throws
CertificateException on attribute handling errors.

public Enumeration<String> getElements ()

Return an enumeration of names of attributes existing within this attribute.

Returns
  • an enumeration of the attribute names.

public String getName ()

Return the name of this attribute.

Returns
  • the name of this CertAttrSet.

public void set (String name, Object obj)

Set the attribute value.

Parameters
name the name of the attribute (e.g. "x509.info.key")
obj the attribute object.
Throws
CertificateException on attribute handling errors.
IOException

public String toString ()

Return the printable string.

Returns
  • a string representation of the object.

public void valid ()

Verify that that the current time is within the validity period.

Throws
CertificateExpiredException if the certificate has expired.
CertificateNotYetValidException if the certificate is not yet valid.

public void valid (Date now)

Verify that that the passed time is within the validity period.

Throws
CertificateExpiredException if the certificate has expired with respect to the Date supplied.
CertificateNotYetValidException if the certificate is not yet valid with respect to the Date supplied.