public class HMACSymmetricKey extends java.lang.Object implements ISymSigningKey
TIMESTAMP_MANUAL, TIMESTAMP_MISSING| Constructor and Description |
|---|
HMACSymmetricKey(byte[] key,
long timestamp)
Creates a new symmetric signing key out of a byte array
|
HMACSymmetricKey(byte[] key,
long timestamp,
SystemID systemID)
Creates a new symmetric signing key out of a byte array
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
createSignature(byte[] message)
Creates a HMAC signature
|
byte[] |
decryptMessage(byte[] message)
Since this key is not for encryption, a runtime exception will be thrown.
|
byte[] |
encryptMessage(byte[] input)
Since this key is not for encryption, a runtime exception will be thrown.
|
boolean |
forEncryption()
This key cannot be used for encryption or decryption, so this method will return false.
|
boolean |
forSigning()
This key can be used for signing, so this method will return true.
|
SystemID |
getCorrespondingSystemID() |
byte[] |
getKey()
Get the key as a byte array.
|
long |
getTimestamp()
Returns the time stamp of a symmetric key or TIMESTAMP_MISSING,
if there is no entry for the key.
|
boolean |
verifySignature(byte[] message,
byte[] signature)
Use this public key to verify a signature.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequalsequalspublic HMACSymmetricKey(byte[] key,
long timestamp,
SystemID systemID)
key - A secret key as a byte arraypublic HMACSymmetricKey(byte[] key,
long timestamp)
key - A secret key as a byte arraypublic byte[] encryptMessage(byte[] input)
encryptMessage in interface IPublicKeyinput - A runtime exception will be thrown.public boolean verifySignature(byte[] message,
byte[] signature)
verifySignature in interface IPublicKeymessage - The message which was signedsignature - The signature of this messagepublic byte[] createSignature(byte[] message)
createSignature in interface IPrivateKeymessage - The message that should be signed as byte arraypublic byte[] decryptMessage(byte[] message)
decryptMessage in interface IPrivateKeymessage - A runtime exception will be thrown.public boolean forEncryption()
forEncryption in interface ISymmetricKeypublic boolean forSigning()
forSigning in interface ISymmetricKeypublic long getTimestamp()
ISymmetricKeygetTimestamp in interface ISymmetricKeypublic byte[] getKey()
ISymmetricKeygetKey in interface ISymmetricKeypublic SystemID getCorrespondingSystemID()
getCorrespondingSystemID in interface ISymmetricKey