APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.provider.certpath

public final Class OCSPNonceExtension

extends Extension
Class Inheritance
Imports
java.io.IOException, java.util.Objects, java.security.SecureRandom, sun.security.x509.Extension, .PKIXExtensions, sun.security.util.Debug, .DerValue

Represent the OCSP Nonce Extension. This extension, if present, provides a nonce value in OCSP requests and responses. This will cryptographically bind requests and responses and help to prevent replay attacks (see RFC 6960, section 4.4.1).
See Also
Extension

Field Summary

Modifier and TypeField and Description
private static final String
EXTENSION_NAME

Attribute name.

private final byte[]
Inherited from sun.security.x509.Extension:
criticalextensionIdextensionValue

Constructor Summary

AccessConstructor and Description
public
OCSPNonceExtension(int
the number of random bytes composing the nonce
length
)

Create an OCSPNonceExtension by providing the nonce length.

public
OCSPNonceExtension(boolean
a boolean flag indicating whether the criticality bit is set for this extension
isCritical
,
int
the number of random bytes composing the nonce
length
)

Create an OCSPNonceExtension by providing the nonce length and criticality setting.

public
OCSPNonceExtension(byte[]
The nonce data to be set for the extension. This must be a non-null array of at least one byte long.
incomingNonce
)

Create an OCSPNonceExtension by providing a nonce value.

public
OCSPNonceExtension(boolean
a boolean flag indicating whether the criticality bit is set for this extension
isCritical
,
byte[]
The nonce data to be set for the extension. This must be a non-null array of at least one byte long and can be up to 32 bytes.
incomingNonce
)

Create an OCSPNonceExtension by providing a nonce value and criticality setting.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the name of the extension
getName
()

Overrides sun.security.x509.Extension.getName.

Return the name of the extension as a String

public byte[]

Returns:

A copy of the underlying nonce bytes
getNonceValue
()

Return the nonce bytes themselves, without any DER encoding.

public String

Returns:

a string representation of the extension.
toString
()

Overrides sun.security.x509.Extension.toString.

Returns a printable representation of the OCSPNonceExtension.

Inherited from sun.security.x509.Extension:
encodeencodeequalsgetExtensionIdgetExtensionValuegetIdgetValuehashCodeisCriticalnewExtension

Field Detail

EXTENSION_NAMEback to summary
private static final String EXTENSION_NAME

Attribute name.

nonceDataback to summary
private final byte[] nonceData

Constructor Detail

OCSPNonceExtensionback to summary
public OCSPNonceExtension(int length) throws IOException

Create an OCSPNonceExtension by providing the nonce length. The criticality is set to false, and the OID for the extension will be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.

Parameters
length:int

the number of random bytes composing the nonce

Exceptions
IOException:
if any errors happen during encoding of the extension.
IllegalArgumentException:
if length is not a positive integer.
OCSPNonceExtensionback to summary
public OCSPNonceExtension(boolean isCritical, int length) throws IOException

Create an OCSPNonceExtension by providing the nonce length and criticality setting. The OID for the extension will be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.

Parameters
isCritical:boolean

a boolean flag indicating whether the criticality bit is set for this extension

length:int

the number of random bytes composing the nonce

Exceptions
IOException:
if any errors happen during encoding of the extension.
IllegalArgumentException:
if length is not in the range of 1 to 32.
OCSPNonceExtensionback to summary
public OCSPNonceExtension(byte[] incomingNonce) throws IOException

Create an OCSPNonceExtension by providing a nonce value. The criticality is set to false, and the OID for the extension will be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.

Parameters
incomingNonce:byte[]

The nonce data to be set for the extension. This must be a non-null array of at least one byte long.

Exceptions
IOException:
if any errors happen during encoding of the extension.
IllegalArgumentException:
if the incomingNonce length is not a positive integer.
NullPointerException:
if the incomingNonce is null.
OCSPNonceExtensionback to summary
public OCSPNonceExtension(boolean isCritical, byte[] incomingNonce) throws IOException

Create an OCSPNonceExtension by providing a nonce value and criticality setting. The OID for the extension will be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.

Parameters
isCritical:boolean

a boolean flag indicating whether the criticality bit is set for this extension

incomingNonce:byte[]

The nonce data to be set for the extension. This must be a non-null array of at least one byte long and can be up to 32 bytes.

Exceptions
IOException:
if any errors happen during encoding of the extension.
IllegalArgumentException:
if the incomingNonce length is not in the range of 1 to 32.
NullPointerException:
if the incomingNonce is null.

Method Detail

getNameback to summary
public String getName()

Overrides sun.security.x509.Extension.getName.

Return the name of the extension as a String

Returns:String

the name of the extension

Annotations
@Override
getNonceValueback to summary
public byte[] getNonceValue()

Return the nonce bytes themselves, without any DER encoding.

Returns:byte[]

A copy of the underlying nonce bytes

toStringback to summary
public String toString()

Overrides sun.security.x509.Extension.toString.

Returns a printable representation of the OCSPNonceExtension.

Returns:String

a string representation of the extension.

Annotations
@Override