Package org.mozilla.jss.pkcs11
Class PK11Signature
- java.lang.Object
-
- org.mozilla.jss.crypto.SignatureSpi
-
- org.mozilla.jss.pkcs11.PK11Signature
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public final class PK11Signature extends SignatureSpi implements java.lang.AutoCloseable
-
-
Field Summary
Fields Modifier and Type Field Description protected Algorithmalgorithmprotected AlgorithmdigestAlgorithmprotected org.mozilla.jss.pkcs11.PK11Keykeyprotected booleanrawprotected java.io.ByteArrayOutputStreamrawInputprotected org.mozilla.jss.pkcs11.SigContextProxysigContextstatic intSIGNprotected intstateprotected PK11Tokentokenprotected TokenProxytokenProxystatic intUNINITIALIZEDstatic intVERIFY
-
Constructor Summary
Constructors Constructor Description PK11Signature(PK11Token token, SignatureAlgorithm algorithm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidengineInitSign(PrivateKey privateKey)voidengineInitSign(PrivateKey privateKey, java.security.SecureRandom random)This is just here for JCA compliance, we don't take randoms this way.voidengineInitVerify(java.security.PublicKey publicKey)protected static booleanengineRawVerifyNative(PK11Token token, java.security.PublicKey key, byte[] hash, byte[] signature)Performs raw verification of the signature of a hash using the given public key, on the given token.voidengineSetParameter(java.security.spec.AlgorithmParameterSpec params)byte[]engineSign()intengineSign(byte[] outbuf, int offset, int len)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()protected voidinitSigContext()Creates a signing context, initializes it, and sets the sigContext field.protected voidinitVfyContext()
-
-
-
Field Detail
-
token
protected PK11Token token
-
tokenProxy
protected TokenProxy tokenProxy
-
algorithm
protected Algorithm algorithm
-
digestAlgorithm
protected Algorithm digestAlgorithm
-
key
protected org.mozilla.jss.pkcs11.PK11Key key
-
state
protected int state
-
sigContext
protected org.mozilla.jss.pkcs11.SigContextProxy sigContext
-
raw
protected boolean raw
-
rawInput
protected java.io.ByteArrayOutputStream rawInput
-
UNINITIALIZED
public static final int UNINITIALIZED
- See Also:
- Constant Field Values
-
SIGN
public static final int SIGN
- See Also:
- Constant Field Values
-
VERIFY
public static final int VERIFY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PK11Signature
public PK11Signature(PK11Token token, SignatureAlgorithm algorithm) throws java.security.NoSuchAlgorithmException, TokenException
- Throws:
java.security.NoSuchAlgorithmExceptionTokenException
-
-
Method Detail
-
engineInitSign
public void engineInitSign(PrivateKey privateKey) throws java.security.InvalidKeyException, TokenException
- Specified by:
engineInitSignin classSignatureSpi- Throws:
java.security.InvalidKeyExceptionTokenException
-
engineInitSign
public void engineInitSign(PrivateKey privateKey, java.security.SecureRandom random) throws java.security.InvalidKeyException, TokenException
This is just here for JCA compliance, we don't take randoms this way.- Specified by:
engineInitSignin classSignatureSpi- Throws:
java.security.InvalidKeyExceptionTokenException
-
initSigContext
protected void initSigContext() throws TokenExceptionCreates a signing context, initializes it, and sets the sigContext field.- Throws:
TokenException
-
engineInitVerify
public void engineInitVerify(java.security.PublicKey publicKey) throws java.security.InvalidKeyException, TokenException- Specified by:
engineInitVerifyin classSignatureSpi- Throws:
java.security.InvalidKeyExceptionTokenException
-
initVfyContext
protected void initVfyContext() throws TokenException- Throws:
TokenException
-
engineUpdate
public void engineUpdate(byte b) throws java.security.SignatureException, TokenException- Specified by:
engineUpdatein classSignatureSpi- Throws:
java.security.SignatureExceptionTokenException
-
engineUpdate
public void engineUpdate(byte[] b, int off, int len) throws java.security.SignatureException, TokenException- Specified by:
engineUpdatein classSignatureSpi- Throws:
java.security.SignatureExceptionTokenException
-
engineUpdateNative
protected void engineUpdateNative(byte[] b, int off, int len) throws TokenException- Throws:
TokenException
-
engineSign
public byte[] engineSign() throws java.security.SignatureException, TokenException- Specified by:
engineSignin classSignatureSpi- Throws:
java.security.SignatureExceptionTokenException
-
engineSign
public int engineSign(byte[] outbuf, int offset, int len) throws java.security.SignatureException, TokenException- Specified by:
engineSignin classSignatureSpi- Throws:
java.security.SignatureExceptionTokenException
-
engineVerify
public boolean engineVerify(byte[] sigBytes) throws java.security.SignatureException, TokenException- Specified by:
engineVerifyin classSignatureSpi- Throws:
java.security.SignatureExceptionTokenException
-
engineRawVerifyNative
protected static boolean engineRawVerifyNative(PK11Token token, java.security.PublicKey key, byte[] hash, byte[] signature) throws java.security.SignatureException, TokenException
Performs raw verification of the signature of a hash using the given public key, on the given token.- Throws:
java.security.SignatureExceptionTokenException
-
engineVerifyNative
protected boolean engineVerifyNative(byte[] sigBytes) throws java.security.SignatureException, TokenException- Throws:
java.security.SignatureExceptionTokenException
-
engineSetParameter
public void engineSetParameter(java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidAlgorithmParameterException, TokenException- Specified by:
engineSetParameterin classSignatureSpi- Throws:
java.security.InvalidAlgorithmParameterExceptionTokenException
-
finalize
public void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
-