support.crypto
Interface CryptoAgent

All Known Implementing Classes:
MyCryptoAgent

public interface CryptoAgent


Field Summary
static int BIG_INT_SEED_BITS
          the number of bits used to represent p and q
static int E_VALUE
          the value of the encryption exponent (aka e)
static int PRIME_CHECK_PRECISION
          the certainty that a number is prime.
 
Method Summary
 byte[] decrypt(byte[] cipher)
          Decrypt cipher using your private key (_d).
 byte[] encrypt(CryptoPublicKey key, byte[] message)
          Encrypt the given message using the provided public key.
 CryptoPublicKey getPublicKey()
          Return a CryptoPublicKey that contains your N and E values.
 

Field Detail

BIG_INT_SEED_BITS

static final int BIG_INT_SEED_BITS
the number of bits used to represent p and q

See Also:
Constant Field Values

PRIME_CHECK_PRECISION

static final int PRIME_CHECK_PRECISION
the certainty that a number is prime. i.e. the probability that a prime number is in fact prime should be: 1 - (1 / 2^PRIME_CHECK_PRECISION)

See Also:
Constant Field Values

E_VALUE

static final int E_VALUE
the value of the encryption exponent (aka e)

See Also:
Constant Field Values
Method Detail

getPublicKey

CryptoPublicKey getPublicKey()
Return a CryptoPublicKey that contains your N and E values.

Returns:
public key containing this CryptoAgent's N and E values.

decrypt

byte[] decrypt(byte[] cipher)
Decrypt cipher using your private key (_d).

Parameters:
cipher - an array of bytes representing an encrypted message.
Returns:
an array of bytes storing the decrypted cipher.

encrypt

byte[] encrypt(CryptoPublicKey key,
               byte[] message)
Encrypt the given message using the provided public key.

Parameters:
key - the public key to be used for the encryption.
message - the message to be encrypted.
Returns:
the encrypted message (cipher).