anon.crypto
Class ByteSignature

java.lang.Object
  extended by anon.crypto.ByteSignature

public final class ByteSignature
extends java.lang.Object

This class contains all basic signature operations.

Author:
Rolf Wendolsky

Constructor Summary
private ByteSignature()
          This class works without being initialised and is completely static.
 
Method Summary
static byte[] sign(byte[] a_message, AsymmetricCryptoKeyPair a_keyPair)
          Signs a message.
static byte[] sign(byte[] a_message, IMyPrivateKey a_privateKey)
          Signs a message.
static java.lang.String toHexString(byte[] a_bytes)
          Creates, from a given byte array, a readable byte string of the form AA:C3:02:21:...
static java.lang.String toHexString(byte[] a_bytes, java.lang.String a_separator)
           
static boolean verify(byte[] a_message, byte[] a_signature, AsymmetricCryptoKeyPair a_keyPair)
          Verifies the signature for a message.
static boolean verify(byte[] a_message, byte[] a_signature, IMyPublicKey a_publicKey)
          Verifies the signature for a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteSignature

private ByteSignature()
This class works without being initialised and is completely static. Therefore, the constructor is not needed and private.

Method Detail

verify

public static boolean verify(byte[] a_message,
                             byte[] a_signature,
                             AsymmetricCryptoKeyPair a_keyPair)
Verifies the signature for a message.

Parameters:
a_message - a message
a_signature - the signature to verify
a_keyPair - a key pair for verification of the signature
Returns:
true if the signature is valid; false otherwise

verify

public static boolean verify(byte[] a_message,
                             byte[] a_signature,
                             IMyPublicKey a_publicKey)
Verifies the signature for a message.

Parameters:
a_message - a message
a_signature - the signature to verify
a_publicKey - a public key for verification of the signature
Returns:
true if the signature is valid; false otherwise

sign

public static byte[] sign(byte[] a_message,
                          AsymmetricCryptoKeyPair a_keyPair)
Signs a message.

Parameters:
a_message - the message to sign
a_keyPair - a key pair for signing
Returns:
the signature or null if no signature could be created

sign

public static byte[] sign(byte[] a_message,
                          IMyPrivateKey a_privateKey)
Signs a message.

Parameters:
a_message - the message to sign
a_privateKey - a private key for signing
Returns:
the signature or null if no signature could be created

toHexString

public static java.lang.String toHexString(byte[] a_bytes)
Creates, from a given byte array, a readable byte string of the form AA:C3:02:21:...

Parameters:
a_bytes - a byte array
Returns:
a readable byte string of the form AA:C3:02:21:...

toHexString

public static java.lang.String toHexString(byte[] a_bytes,
                                           java.lang.String a_separator)