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, wait
equals
equals
public 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 IPublicKey
input
- A runtime exception will be thrown.public boolean verifySignature(byte[] message, byte[] signature)
verifySignature
in interface IPublicKey
message
- The message which was signedsignature
- The signature of this messagepublic byte[] createSignature(byte[] message)
createSignature
in interface IPrivateKey
message
- The message that should be signed as byte arraypublic byte[] decryptMessage(byte[] message)
decryptMessage
in interface IPrivateKey
message
- A runtime exception will be thrown.public boolean forEncryption()
forEncryption
in interface ISymmetricKey
public boolean forSigning()
forSigning
in interface ISymmetricKey
public long getTimestamp()
ISymmetricKey
getTimestamp
in interface ISymmetricKey
public byte[] getKey()
ISymmetricKey
getKey
in interface ISymmetricKey
public SystemID getCorrespondingSystemID()
getCorrespondingSystemID
in interface ISymmetricKey