All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----is.hi.logir.cryptonite.Cryptonite
|
+----is.hi.logir.cryptonite.K
|
+----is.hi.logir.cryptonite.RSAKey
Each RSA key is a pair (r,n) of integers and matches another key (s,n). If P is a block of plain data represented as an integer smaller than n, then it can be encrypted with the transformation:
E = (P^r) mod n
which has the inverse transformation:
P = (E^s) mod n
The key owner will keep one key secret and publish the other as widely as possible. This allows anyone who gets hold of the public key to encrypt data which can only be decrypted with the corresponding private key.
Data that is encrypted with a private key can similarly only be decrypted with the corresponding public key. This is useful for digital signatures.
When P is created from an array of bytes, it will correspond to as many bytes of plain data as the bytes needed to store n, less one.
Each chunk of data encrypted with RSAKey has as many bytes as the key modulo. however, the plain data it encodes has one less byte.
The CDS for the RSAKey class is RSAKey(r,n,pub) for a public key
or RSAKey(r,n,pri) for a private key. In both cases r
and n are hexadecimal numbers.
(r,n).
Cryptonite.fromString(String) .
(r,n) and the private RSA key (s,n).
source, starting at
i, and write it to dest, starting at
j.
source, starting at
i, and write it to dest, starting at
j.
s is a signature for fp
created with this key in the case of a symmetric key, or the other
key in the pair in the case of an asymmetric key.
fp.
public RSAKey(BigInteger r,
BigInteger n,
boolean pri)
(r,n).
It is a private key if pri is true.
public RSAKey(String arg) throws InvalidCDSException
Cryptonite.fromString(String) .
public static KeyPair createKeys(int bitLength)
bitLength or bitLength-1 bits.
public static KeyPair createKeys(BigInteger r,
BigInteger s,
BigInteger n) throws KeyException
(r,n) and the private RSA key (s,n).
public int getSize()
public String getAlgorithm()
public boolean isPrivate()
public String toString()
public boolean equals(Object key)
public final boolean matches(Key key)
public int plainBlockSize()
public int cipherBlockSize()
public final void encrypt(byte source[],
int i,
byte dest[],
int j)
source, starting at
i, and write it to dest, starting at
j.
public void decrypt(byte source[],
int i,
byte dest[],
int j)
source, starting at
i, and write it to dest, starting at
j.
public int signBlockSize()
public int signatureSize()
public Signature sign(Fingerprint fp) throws KeyException
fp.
public boolean matches(Signature s,
Fingerprint fp)
s is a signature for fp
created with this key in the case of a symmetric key, or the other
key in the pair in the case of an asymmetric key.
All Packages Class Hierarchy This Package Previous Next Index