crypto
Class Signatures

java.lang.Object
  extended bycrypto.Signatures

public class Signatures
extends java.lang.Object

Provides methods to digitally sign and verify signatures

Author:
cooperse

Constructor Summary
Signatures()
           
 
Method Summary
static byte[] generateDigest(byte[] data)
          Generates a SHA1 message digest hash
static byte[] sign(java.security.PrivateKey key, byte[] data)
          Digitally signs the given data using the given KeyPair's private key
static boolean verify(java.security.PublicKey key, byte[] data, byte[] signed)
          Verifies the signature on the given data using the given KeyPair
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Signatures

public Signatures()
Method Detail

sign

public static byte[] sign(java.security.PrivateKey key,
                          byte[] data)
Digitally signs the given data using the given KeyPair's private key

Parameters:
key - The sender's private key
data - The data to be signed
Returns:
A byte[] containing the signed data

verify

public static boolean verify(java.security.PublicKey key,
                             byte[] data,
                             byte[] signed)
Verifies the signature on the given data using the given KeyPair

Parameters:
key - The sender's public key
data - The unsigned data
signed - The signature
Returns:
True or false depending on whether the data verifies

generateDigest

public static byte[] generateDigest(byte[] data)
Generates a SHA1 message digest hash

Parameters:
data - The byte[] to hash
Returns:
The mesage digest