public abstract class AbstractSecurityKeySignature extends java.lang.Object implements Signature
Modifier and Type | Field and Description |
---|---|
private java.security.MessageDigest |
challengeDigest |
private static int |
FLAG_USER_PRESENCE |
private java.lang.String |
keyType |
private SecurityKeyPublicKey<?> |
publicKey |
Modifier | Constructor and Description |
---|---|
protected |
AbstractSecurityKeySignature(java.lang.String keyType) |
Modifier and Type | Method and Description |
---|---|
protected abstract Signature |
getDelegateSignature() |
protected abstract java.lang.String |
getSignatureKeyType() |
void |
initSigner(SessionContext session,
java.security.PrivateKey key) |
void |
initVerifier(SessionContext session,
java.security.PublicKey key) |
byte[] |
sign(SessionContext session)
Compute the signature
|
void |
update(SessionContext session,
byte[] hash,
int off,
int len)
Update the computed signature with the given data
|
boolean |
verify(SessionContext session,
byte[] sig)
Verify against the given signature
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSshAlgorithmName, update
getAlgorithm
private static final int FLAG_USER_PRESENCE
private final java.lang.String keyType
private SecurityKeyPublicKey<?> publicKey
private java.security.MessageDigest challengeDigest
protected AbstractSecurityKeySignature(java.lang.String keyType)
public void initVerifier(SessionContext session, java.security.PublicKey key) throws java.security.GeneralSecurityException
initVerifier
in interface Signature
session
- The SessionContext
for calling this method - may be null
if not called within a
session contextkey
- The PublicKey
to be used for verifying signaturesjava.security.GeneralSecurityException
public void update(SessionContext session, byte[] hash, int off, int len)
Signature
update
in interface Signature
session
- The SessionContext
for calling this method - may be null
if not called within a
session contexthash
- The hash data bufferoff
- Offset of hash data in bufferlen
- Length of hash dataprotected abstract java.lang.String getSignatureKeyType()
protected abstract Signature getDelegateSignature()
public boolean verify(SessionContext session, byte[] sig) throws java.lang.Exception
Signature
verify
in interface Signature
session
- The SessionContext
for calling this method - may be null
if not called within a
session contextsig
- The signed datatrue
if signature is validjava.lang.Exception
- If failed to extract signed data for validationpublic void initSigner(SessionContext session, java.security.PrivateKey key)
initSigner
in interface Signature
session
- The SessionContext
for calling this method - may be null
if not called within a
session contextkey
- The PrivateKey
to be used for signingpublic byte[] sign(SessionContext session)
Signature
sign
in interface Signature
session
- The SessionContext
for calling this method - may be null
if not called within a
session context