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

pack-priv final Class P11PSSSignature

extends SignatureSpi
Class Inheritance
Imports
java.nio.ByteBuffer, jdk.internal.access.JavaNioAccess, .SharedSecrets, sun.nio.ch.DirectBuffer, java.util.Hashtable, java.security.*, java.security.spec.AlgorithmParameterSpec, .MGF1ParameterSpec, .PSSParameterSpec, java.security.interfaces.*, sun.security.pkcs11.wrapper.*, sun.security.util.KnownOIDs

RSASSA-PSS Signature implementation class. This class currently supports the following algorithms: . RSA-PSS: . RSASSA-PSS . SHA1withRSASSA-PSS . SHA224withRSASSA-PSS . SHA256withRSASSA-PSS . SHA384withRSASSA-PSS . SHA512withRSASSA-PSS . SHA3-224withRSASSA-PSS . SHA3-256withRSASSA-PSS . SHA3-384withRSASSA-PSS . SHA3-512withRSASSA-PSS Note that the underlying PKCS#11 token may support complete signature algorithm (e.g. CKM__RSA_PKCS_PSS), or it may just implement the signature algorithm without hashing (i.e. CKM_RSA_PKCS_PSS). This class uses what is available and adds whatever extra processing is needed.
Since
13

Field Summary

Modifier and TypeField and Description
private final String
private final byte[]
private int
private static final boolean
private static final Hashtable<String, Integer>
private boolean
private boolean
private static final String
private static final int
private static final int
private MessageDigest
private final String
private final CK_MECHANISM
private int
private static final JavaNioAccess
private P11Key
private Session
private PSSParameterSpec
private static final int
private static final int
private final Token
private final int
Inherited from java.security.SignatureSpi:
appRandom

Constructor Summary

AccessConstructor and Description
pack-priv
P11PSSSignature(Token token, String algorithm, long mechId)

Method Summary

Modifier and TypeMethod and Description
private void
private void
protected Object
engineGetParameter(String param)

Implements abstract java.security.SignatureSpi.engineGetParameter.

Gets the value of the specified algorithm parameter.

protected AlgorithmParameters
engineGetParameters()

Overrides java.security.SignatureSpi.engineGetParameters.

Returns the parameters used with this Signature object.

protected void
engineInitSign(PrivateKey privateKey)

Implements abstract java.security.SignatureSpi.engineInitSign.

Initializes this Signature object with the specified private key for signing operations.

protected void
engineInitVerify(PublicKey publicKey)

Implements abstract java.security.SignatureSpi.engineInitVerify.

Initializes this Signature object with the specified public key for verification operations.

protected void
engineSetParameter(String param, Object value)

Implements abstract java.security.SignatureSpi.engineSetParameter.

Sets the specified algorithm parameter to the specified value.

protected void
engineSetParameter(AlgorithmParameterSpec params)

Overrides java.security.SignatureSpi.engineSetParameter.

Initializes this Signature object with the specified parameter values.

protected byte[]
engineSign()

Implements abstract java.security.SignatureSpi.engineSign.

Returns the signature bytes of all the data updated so far.

protected void
engineUpdate(byte b)

Implements abstract java.security.SignatureSpi.engineUpdate.

Updates the data to be signed or verified using the specified byte.

protected void
engineUpdate(byte[] b, int ofs, int len)

Implements abstract java.security.SignatureSpi.engineUpdate.

Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.

protected void
engineUpdate(ByteBuffer byteBuffer)

Overrides java.security.SignatureSpi.engineUpdate.

Updates the data to be signed or verified using the specified ByteBuffer.

protected boolean
engineVerify(byte[] signature)

Implements abstract java.security.SignatureSpi.engineVerify.

Verifies the passed-in signature.

private void
private static PSSParameterSpec
genDefaultParams(String digestAlg, P11Key key)

private void
private static boolean
isDigestEqual(String stdAlg, String givenAlg)

private void
reset(boolean doCancel)

private void
private static String
toStdName(String givenDigestAlg)

Inherited from java.security.SignatureSpi:
cloneengineInitSignengineSignengineVerify

Field Detail

algorithmback to summary
private final String algorithm
bufferback to summary
private final byte[] buffer
bytesProcessedback to summary
private int bytesProcessed
DEBUGback to summary
private static final boolean DEBUG
DIGEST_LENGTHSback to summary
private static final Hashtable<String, Integer> DIGEST_LENGTHS
initializedback to summary
private boolean initialized
isActiveback to summary
private boolean isActive
KEY_ALGOback to summary
private static final String KEY_ALGO
M_SIGNback to summary
private static final int M_SIGN
M_VERIFYback to summary
private static final int M_VERIFY
mdback to summary
private MessageDigest md
mdAlgback to summary
private final String mdAlg
mechanismback to summary
private final CK_MECHANISM mechanism
modeback to summary
private int mode
NIO_ACCESSback to summary
private static final JavaNioAccess NIO_ACCESS
p11Keyback to summary
private P11Key p11Key
sessionback to summary
private Session session
sigParamsback to summary
private PSSParameterSpec sigParams
T_DIGESTback to summary
private static final int T_DIGEST
T_UPDATEback to summary
private static final int T_UPDATE
tokenback to summary
private final Token token
typeback to summary
private final int type

Constructor Detail

P11PSSSignatureback to summary
pack-priv P11PSSSignature(Token token, String algorithm, long mechId) throws NoSuchAlgorithmException, PKCS11Exception

Method Detail

cancelOperationback to summary
private void cancelOperation()
checkKeySizeback to summary
private void checkKeySize(Key key) throws InvalidKeyException
engineGetParameterback to summary
protected Object engineGetParameter(String param) throws InvalidParameterException

Implements abstract java.security.SignatureSpi.engineGetParameter.

Doc from java.security.SignatureSpi.engineGetParameter.

Gets the value of the specified algorithm parameter. This method supplies a general-purpose mechanism through which it is possible to get the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time.

Annotations
@SuppressWarnings:deprecation
@Override
Exceptions
InvalidParameterException:
if param is an invalid parameter for this engine, or another exception occurs while trying to get this parameter.
engineGetParametersback to summary
protected AlgorithmParameters engineGetParameters()

Overrides java.security.SignatureSpi.engineGetParameters.

Doc from java.security.SignatureSpi.engineGetParameters.

Returns the parameters used with this Signature object.

The returned parameters may be the same that were used to initialize this Signature object, or may contain additional default or random parameter values used by the underlying signature scheme. If the required parameters were not supplied and can be generated by the Signature object, the generated parameters are returned; otherwise null is returned.

However, if the signature scheme does not support returning the parameters as AlgorithmParameters, null is always returned.

Annotations
@Override
engineInitSignback to summary
protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException

Implements abstract java.security.SignatureSpi.engineInitSign.

Doc from java.security.SignatureSpi.engineInitSign.

Initializes this Signature object with the specified private key for signing operations.

Annotations
@Override
Exceptions
InvalidKeyException:
if the key is improperly encoded, parameters are missing, and so on.
engineInitVerifyback to summary
protected void engineInitVerify(PublicKey publicKey) throws InvalidKeyException

Implements abstract java.security.SignatureSpi.engineInitVerify.

Doc from java.security.SignatureSpi.engineInitVerify.

Initializes this Signature object with the specified public key for verification operations.

Annotations
@Override
Exceptions
InvalidKeyException:
if the key is improperly encoded, parameters are missing, and so on.
engineSetParameterback to summary
protected void engineSetParameter(String param, Object value) throws InvalidParameterException

Implements abstract java.security.SignatureSpi.engineSetParameter.

Doc from java.security.SignatureSpi.engineSetParameter.

Sets the specified algorithm parameter to the specified value. This method supplies a general-purpose mechanism through which it is possible to set the various parameters of this object. A parameter may be any settable parameter for the algorithm, such as a parameter size, or a source of random bits for signature generation (if appropriate), or an indication of whether to perform a specific but optional computation. A uniform algorithm-specific naming scheme for each parameter is desirable but left unspecified at this time.

Annotations
@SuppressWarnings:deprecation
@Override
Exceptions
InvalidParameterException:
if param is an invalid parameter for this Signature object, the parameter is already set and cannot be set again, a security exception occurs, and so on.
engineSetParameterback to summary
protected void engineSetParameter(AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException

Overrides java.security.SignatureSpi.engineSetParameter.

Doc from java.security.SignatureSpi.engineSetParameter.

Initializes this Signature object with the specified parameter values.

Annotations
@Override
Exceptions
InvalidAlgorithmParameterException:
if this method is overridden by a provider and the given parameters are inappropriate for this Signature object
engineSignback to summary
protected byte[] engineSign() throws SignatureException

Implements abstract java.security.SignatureSpi.engineSign.

Doc from java.security.SignatureSpi.engineSign.

Returns the signature bytes of all the data updated so far. The format of the signature depends on the underlying signature scheme.

Annotations
@Override
Exceptions
SignatureException:
if the engine is not initialized properly or if this signature algorithm is unable to process the input data provided.
engineUpdateback to summary
protected void engineUpdate(byte b) throws SignatureException

Implements abstract java.security.SignatureSpi.engineUpdate.

Doc from java.security.SignatureSpi.engineUpdate.

Updates the data to be signed or verified using the specified byte.

Annotations
@Override
Exceptions
SignatureException:
if the engine is not initialized properly.
engineUpdateback to summary
protected void engineUpdate(byte[] b, int ofs, int len) throws SignatureException

Implements abstract java.security.SignatureSpi.engineUpdate.

Doc from java.security.SignatureSpi.engineUpdate.

Updates the data to be signed or verified, using the specified array of bytes, starting at the specified offset.

Annotations
@Override
Exceptions
SignatureException:
if the engine is not initialized properly
engineUpdateback to summary
protected void engineUpdate(ByteBuffer byteBuffer)

Overrides java.security.SignatureSpi.engineUpdate.

Doc from java.security.SignatureSpi.engineUpdate.

Updates the data to be signed or verified using the specified ByteBuffer. Processes the data.remaining() bytes starting at data.position(). Upon return, the buffer's position will be equal to its limit; its limit will not have changed.

Annotations
@Override
engineVerifyback to summary
protected boolean engineVerify(byte[] signature) throws SignatureException

Implements abstract java.security.SignatureSpi.engineVerify.

Doc from java.security.SignatureSpi.engineVerify.

Verifies the passed-in signature.

Annotations
@Override
Exceptions
SignatureException:
if the engine is not initialized properly, the passed-in signature is improperly encoded or of the wrong type, if this signature algorithm is unable to process the input data provided, etc.
ensureInitializedback to summary
private void ensureInitialized() throws SignatureException
genDefaultParamsback to summary
private static PSSParameterSpec genDefaultParams(String digestAlg, P11Key key) throws SignatureException
initializeback to summary
private void initialize() throws ProviderException
isDigestEqualback to summary
private static boolean isDigestEqual(String stdAlg, String givenAlg)
resetback to summary
private void reset(boolean doCancel)
setSigParamsback to summary
private void setSigParams(AlgorithmParameterSpec p) throws InvalidAlgorithmParameterException
toStdNameback to summary
private static String toStdName(String givenDigestAlg)