Package org.conscrypt
Class OpenSSLSignature
java.lang.Object
java.security.SignatureSpi
org.conscrypt.OpenSSLSignature
- Direct Known Subclasses:
OpenSSLSignature.RSAPKCS1Padding
,OpenSSLSignature.RSAPSSPadding
,OpenSSLSignature.SHA1ECDSA
,OpenSSLSignature.SHA224ECDSA
,OpenSSLSignature.SHA256ECDSA
,OpenSSLSignature.SHA384ECDSA
,OpenSSLSignature.SHA512ECDSA
Implements the subset of the JDK Signature interface needed for
signature verification using OpenSSL.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static enum
static final class
(package private) static class
Base class forRSASSA-PKCS1-v1_5
signatures.(package private) static class
Base class forRSASSA-PSS
signatures.static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NativeRef.EVP_MD_CTX
private final OpenSSLSignature.EngineType
Holds the type of the Java algorithm.private final long
Digest algorithm (reference toEVP_MD
).private long
Public key algorithm context (reference toEVP_PKEY_CTX
).private OpenSSLKey
The current OpenSSL key we're operating on.private boolean
True when engine is initialized to signing.private final byte[]
Holds a dummy buffer for writing single bytes to the digest.Fields inherited from class java.security.SignatureSpi
appRandom
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
OpenSSLSignature
(long evpMdRef, OpenSSLSignature.EngineType engineType) Creates a new OpenSSLSignature instance for the given algorithm name. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
checkEngineType
(OpenSSLKey pkey) protected void
configureEVP_PKEY_CTX
(long ctx) Configures the public key algorithm context (EVP_PKEY_CTX
) associated with this operation.protected Object
engineGetParameter
(String param) Deprecated.protected void
engineInitSign
(PrivateKey privateKey) protected void
engineInitVerify
(PublicKey publicKey) protected void
engineSetParameter
(String param, Object value) Deprecated.protected byte[]
protected void
engineUpdate
(byte input) protected void
engineUpdate
(byte[] input, int offset, int len) protected void
engineUpdate
(ByteBuffer input) protected boolean
engineVerify
(byte[] sigBytes) protected final long
Returns the public key algorithm context (EVP_PKEY_CTX
reference) associated with this operation or0
if operation hasn't been initialized.private void
initInternal
(OpenSSLKey newKey, boolean signing) private void
Methods inherited from class java.security.SignatureSpi
clone, engineGetParameters, engineInitSign, engineSetParameter, engineSign, engineVerify
-
Field Details
-
ctx
-
key
The current OpenSSL key we're operating on. -
engineType
Holds the type of the Java algorithm. -
evpMdRef
private final long evpMdRefDigest algorithm (reference toEVP_MD
). -
singleByte
private final byte[] singleByteHolds a dummy buffer for writing single bytes to the digest. -
signing
private boolean signingTrue when engine is initialized to signing. -
evpPkeyCtx
private long evpPkeyCtxPublic key algorithm context (reference toEVP_PKEY_CTX
).
-
-
Constructor Details
-
OpenSSLSignature
Creates a new OpenSSLSignature instance for the given algorithm name.- Parameters:
evpMdRef
- digest algorithm (EVP_MD
reference).
-
-
Method Details
-
resetContext
-
configureEVP_PKEY_CTX
Configures the public key algorithm context (EVP_PKEY_CTX
) associated with this operation.The default implementation does nothing.
- Parameters:
ctx
- reference to the context (EVP_PKEY_CTX
).- Throws:
InvalidAlgorithmParameterException
-
engineUpdate
protected void engineUpdate(byte input) - Specified by:
engineUpdate
in classSignatureSpi
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len) - Specified by:
engineUpdate
in classSignatureSpi
-
engineUpdate
- Overrides:
engineUpdate
in classSignatureSpi
-
engineGetParameter
Deprecated.- Specified by:
engineGetParameter
in classSignatureSpi
- Throws:
InvalidParameterException
-
checkEngineType
- Throws:
InvalidKeyException
-
initInternal
- Throws:
InvalidKeyException
-
engineInitSign
- Specified by:
engineInitSign
in classSignatureSpi
- Throws:
InvalidKeyException
-
engineInitVerify
- Specified by:
engineInitVerify
in classSignatureSpi
- Throws:
InvalidKeyException
-
engineSetParameter
@Deprecated protected void engineSetParameter(String param, Object value) throws InvalidParameterException Deprecated.- Specified by:
engineSetParameter
in classSignatureSpi
- Throws:
InvalidParameterException
-
engineSign
- Specified by:
engineSign
in classSignatureSpi
- Throws:
SignatureException
-
engineVerify
- Specified by:
engineVerify
in classSignatureSpi
- Throws:
SignatureException
-
getEVP_PKEY_CTX
protected final long getEVP_PKEY_CTX()Returns the public key algorithm context (EVP_PKEY_CTX
reference) associated with this operation or0
if operation hasn't been initialized.
-