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 Algorithm
protected Algorithm
protected PK11Key
static final String
static final String
static final String
static final String
static final String
static final String
protected boolean
protected ByteArrayOutputStream
static final String
protected SigContextProxy
static final int
protected int
protected PK11Token
protected TokenProxy
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
engineInitSign
(PrivateKey privateKey) void
engineInitSign
(PrivateKey privateKey, SecureRandom random) This is just here for JCA compliance, we don't take randoms this way.void
engineInitVerify
(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 boolean
engineRawVerifyNative
(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.void
byte[]
int
engineSign
(byte[] outbuf, int offset, int len) private byte[]
void
engineUpdate
(byte b) void
engineUpdate
(byte[] b, int off, int len) protected void
engineUpdateNative
(byte[] b, int off, int len) boolean
engineVerify
(byte[] sigBytes) protected boolean
engineVerifyNative
(byte[] sigBytes) void
finalize()
private Algorithm
protected void
Creates a signing context, initializes it, and sets the sigContext field.protected void
private boolean
isRSAPSSAlgorithm
(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:
engineInitSign
in classSignatureSpi
- Throws:
InvalidKeyException
TokenException
-
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:
engineInitSign
in classSignatureSpi
- Throws:
InvalidKeyException
TokenException
-
initSigContext
Creates a signing context, initializes it, and sets the sigContext field.- Throws:
TokenException
-
engineInitVerify
- Specified by:
engineInitVerify
in classSignatureSpi
- Throws:
InvalidKeyException
TokenException
-
initVfyContext
- Throws:
TokenException
-
engineUpdate
- Specified by:
engineUpdate
in classSignatureSpi
- Throws:
SignatureException
TokenException
-
engineUpdate
- Specified by:
engineUpdate
in classSignatureSpi
- Throws:
SignatureException
TokenException
-
validateUpdate
- Throws:
SignatureException
-
engineUpdateNative
- Throws:
TokenException
-
engineSign
- Specified by:
engineSign
in classSignatureSpi
- Throws:
SignatureException
TokenException
-
engineSign
- Specified by:
engineSign
in classSignatureSpi
- Throws:
SignatureException
TokenException
-
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:
SignatureException
TokenException
-
engineSignNative
- Throws:
SignatureException
TokenException
-
engineVerify
- Specified by:
engineVerify
in classSignatureSpi
- Throws:
SignatureException
TokenException
-
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:
SignatureException
TokenException
-
engineVerifyNative
- Throws:
SignatureException
TokenException
-
engineSetParameter
public void engineSetParameter(AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException, TokenException - Specified by:
engineSetParameter
in classSignatureSpi
- Throws:
InvalidAlgorithmParameterException
TokenException
-
getRSAPSSDigestAlgFromSpec
private Algorithm getRSAPSSDigestAlgFromSpec(PSSParameterSpec params) throws InvalidAlgorithmParameterException -
isRSAPSSAlgorithm
-
finalize
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-