Package org.mozilla.jss.pkcs11
Class PK11Signature
java.lang.Object
org.mozilla.jss.crypto.SignatureSpi
org.mozilla.jss.pkcs11.PK11Signature
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Algorithmprotected Algorithmprotected PK11Keystatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected booleanprotected ByteArrayOutputStreamstatic final Stringprotected SigContextProxystatic final intprotected intprotected PK11Tokenprotected TokenProxystatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidengineInitSign(PrivateKey privateKey) voidengineInitSign(PrivateKey privateKey, SecureRandom random) This is just here for JCA compliance, we don't take randoms this way.voidengineInitVerify(PublicKey publicKey) private static byte[]engineRawSignNative(PK11Token token, PrivateKey key, byte[] hash) Performs raw signing of the given hash with the given private key.protected static booleanengineRawVerifyNative(PK11Token token, PublicKey key, byte[] hash, byte[] signature) Performs raw verification of the signature of a hash using the given public key, on the given token.voidbyte[]intengineSign(byte[] outbuf, int offset, int len) private byte[]voidengineUpdate(byte b) voidengineUpdate(byte[] b, int off, int len) protected voidengineUpdateNative(byte[] b, int off, int len) booleanengineVerify(byte[] sigBytes) protected booleanengineVerifyNative(byte[] sigBytes) voidfinalize()private Algorithmprotected voidCreates a signing context, initializes it, and sets the sigContext field.protected voidprivate booleanisRSAPSSAlgorithm(SignatureAlgorithm algorithm) private void
-
Field Details
-
NO_TOKEN
- See Also:
-
NO_TOKEN_PROXY
- See Also:
-
NO_ALGORTIHM
- See Also:
-
NO_KEY
- See Also:
-
NO_CONTEXT
- See Also:
-
SIG_NOT_INITIALIZED
- See Also:
-
NO_INPUT_STREAM
- See Also:
-
token
-
tokenProxy
-
algorithm
-
digestAlgorithm
-
key
-
state
protected int state -
sigContext
-
raw
protected boolean raw -
rawInput
-
UNINITIALIZED
public static final int UNINITIALIZED- See Also:
-
SIGN
public static final int SIGN- See Also:
-
VERIFY
public static final int VERIFY- See Also:
-
-
Constructor Details
-
PK11Signature
public PK11Signature(PK11Token token, SignatureAlgorithm algorithm) throws NoSuchAlgorithmException, TokenException
-
-
Method Details
-
engineInitSign
- Specified by:
engineInitSignin classSignatureSpi- Throws:
InvalidKeyExceptionTokenException
-
engineInitSign
public void engineInitSign(PrivateKey privateKey, SecureRandom random) throws InvalidKeyException, TokenException This is just here for JCA compliance, we don't take randoms this way.- Specified by:
engineInitSignin classSignatureSpi- Throws:
InvalidKeyExceptionTokenException
-
initSigContext
Creates a signing context, initializes it, and sets the sigContext field.- Throws:
TokenException
-
engineInitVerify
- Specified by:
engineInitVerifyin classSignatureSpi- Throws:
InvalidKeyExceptionTokenException
-
initVfyContext
- Throws:
TokenException
-
engineUpdate
- Specified by:
engineUpdatein classSignatureSpi- Throws:
SignatureExceptionTokenException
-
engineUpdate
- Specified by:
engineUpdatein classSignatureSpi- Throws:
SignatureExceptionTokenException
-
validateUpdate
- Throws:
SignatureException
-
engineUpdateNative
- Throws:
TokenException
-
engineSign
- Specified by:
engineSignin classSignatureSpi- Throws:
SignatureExceptionTokenException
-
engineSign
- Specified by:
engineSignin classSignatureSpi- Throws:
SignatureExceptionTokenException
-
engineRawSignNative
private static byte[] engineRawSignNative(PK11Token token, PrivateKey key, byte[] hash) throws SignatureException, TokenException Performs raw signing of the given hash with the given private key.- Throws:
SignatureExceptionTokenException
-
engineSignNative
- Throws:
SignatureExceptionTokenException
-
engineVerify
- Specified by:
engineVerifyin classSignatureSpi- Throws:
SignatureExceptionTokenException
-
engineRawVerifyNative
protected static boolean engineRawVerifyNative(PK11Token token, PublicKey key, byte[] hash, byte[] signature) throws SignatureException, TokenException Performs raw verification of the signature of a hash using the given public key, on the given token.- Throws:
SignatureExceptionTokenException
-
engineVerifyNative
- Throws:
SignatureExceptionTokenException
-
engineSetParameter
public void engineSetParameter(AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException, TokenException - Specified by:
engineSetParameterin classSignatureSpi- Throws:
InvalidAlgorithmParameterExceptionTokenException
-
getRSAPSSDigestAlgFromSpec
private Algorithm getRSAPSSDigestAlgFromSpec(PSSParameterSpec params) throws InvalidAlgorithmParameterException -
isRSAPSSAlgorithm
-
finalize
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-