APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.x509

public Class PrivateKeyUsageExtension

extends Extension
Class Inheritance
Imports
java.io.IOException, java.security.cert.CertificateException, .CertificateParsingException, .CertificateExpiredException, .CertificateNotYetValidException, java.util.Date, .Objects, sun.security.util.*

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 }
Authors
Amit Kapoor, Hemma Prafullchandra
See Also
Extension

Field Summary

Modifier and TypeField and Description
public static final String
private Date
private Date
private static final byte
private static final byte
Inherited from sun.security.x509.Extension:
criticalextensionIdextensionValue

Constructor Summary

AccessConstructor and Description
public
PrivateKeyUsageExtension(Date
the date/time before which the private key should not be used
notBefore
,
Date
the date/time after which the private key should not be used.
notAfter
)

The default constructor for PrivateKeyUsageExtension.

public
PrivateKeyUsageExtension(Boolean
true if the extension is to be treated as critical.
critical
,
Object
an array of DER encoded bytes of the actual value.
value
)

Create the extension from the passed DER encoded value.

Method Summary

Modifier and TypeMethod and Description
public void
encode(DerOutputStream
the DerOutputStream to write the extension to.
out
)

Overrides sun.security.x509.Extension.encode.

Implements sun.security.util.DerEncoder.encode.

Write the extension to the OutputStream.

private void
public String
getName()

Overrides sun.security.x509.Extension.getName.

Return the name of this extension.

public Date
public Date
public String
toString()

Overrides sun.security.x509.Extension.toString.

Return the printable string.

public void
valid()

Verify that the current time is within the validity period.

public void
valid(Date now)

Verify that the passed time is within the validity period.

Inherited from sun.security.x509.Extension:
encodeequalsgetExtensionIdgetExtensionValuegetIdgetValuehashCodeisCriticalnewExtension

Field Detail

NAMEback to summary
public static final String NAME
notAfterback to summary
private Date notAfter
notBeforeback to summary
private Date notBefore
TAG_AFTERback to summary
private static final byte TAG_AFTER
TAG_BEFOREback to summary
private static final byte TAG_BEFORE

Constructor Detail

PrivateKeyUsageExtensionback to summary
public PrivateKeyUsageExtension(Date notBefore, Date notAfter)

The default constructor for PrivateKeyUsageExtension. At least one of the arguments must be non null.

Parameters
notBefore:Date

the date/time before which the private key should not be used

notAfter:Date

the date/time after which the private key should not be used.

PrivateKeyUsageExtensionback to summary
public PrivateKeyUsageExtension(Boolean critical, Object value) throws CertificateException, IOException

Create the extension from the passed DER encoded value.

Parameters
critical:Boolean

true if the extension is to be treated as critical.

value:Object

an array of DER encoded bytes of the actual value.

Exceptions
CertificateException:
on certificate parsing errors.
IOException:
on error.
ClassCastException:
if value is not an array of bytes

Method Detail

encodeback to summary
public void encode(DerOutputStream out)

Overrides sun.security.x509.Extension.encode.

Implements sun.security.util.DerEncoder.encode.

Write the extension to the OutputStream.

Parameters
out:DerOutputStream

the DerOutputStream to write the extension to.

Annotations
@Override
encodeThisback to summary
private void encodeThis()
getNameback to summary
public String getName()

Overrides sun.security.x509.Extension.getName.

Return the name of this extension.

Annotations
@Override
getNotAfterback to summary
public Date getNotAfter()
getNotBeforeback to summary
public Date getNotBefore()
toStringback to summary
public String toString()

Overrides sun.security.x509.Extension.toString.

Return the printable string.

validback to summary
public void valid() throws CertificateNotYetValidException, CertificateExpiredException

Verify that the current time is within the validity period.

Exceptions
CertificateNotYetValidException:
if the certificate is not yet valid.
CertificateExpiredException:
if the certificate has expired.
validback to summary
public void valid(Date now) throws CertificateNotYetValidException, CertificateExpiredException

Verify that the passed time is within the validity period.

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