|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cryptix.security.rsa.PublicKey
This class represents an RSA public key. It can only verify signatures or encrypt.
Copyright © 1995-1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.2 $
cryptix.provider.rsa.BaseRSAPublicKey
Field Summary | |
protected BigInteger |
e_
Deprecated. The public exponent as a cryptix.math.BigInteger. |
protected BigInteger |
n_
Deprecated. The public modulus as a cryptix.math.BigInteger. |
Constructor Summary | |
protected |
PublicKey()
Deprecated. A constructor that does nothing, for use by subclasses. |
|
PublicKey(BigInteger n,
BigInteger e)
Deprecated. Creates a public key from a modulus and exponent. |
|
PublicKey(PublicKey from)
Deprecated. Creates a new public key from an existing key. |
Method Summary | |
int |
bitLength()
Deprecated. Gets the key's bit length. |
void |
copy(java.lang.Object src)
Deprecated. Copies a key if it is an instance of cryptix.security.rsa.PublicKey. |
BigInteger |
e()
Deprecated. Returns a new cryptix.math.BigInteger equal to the public exponent. |
BigInteger |
encrypt(BigInteger plain)
Deprecated. Encrypts a number using this key. |
boolean |
equals(java.lang.Object obj)
Deprecated. Tests whether another object is equal to this one. |
byte[] |
fingerPrint()
Deprecated. Gets the key's fingerprint. |
byte[] |
id()
Deprecated. Gets the key's ID. |
BigInteger |
n()
Deprecated. Returns a new cryptix.math.BigInteger equal to the public modulus. |
java.lang.String |
toString()
Deprecated. Returns a string representation of this key in hex. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected BigInteger n_
protected BigInteger e_
Constructor Detail |
protected PublicKey()
public PublicKey(BigInteger n, BigInteger e)
n
- the public moduluse
- the public exponentpublic PublicKey(PublicKey from)
from
- the key to copy.Method Detail |
public final BigInteger n()
public final BigInteger e()
public void copy(java.lang.Object src)
src
- the object to copy fromClassCastException
- if !(src instanceof cryptix.security.rsa.PublicKey)public boolean equals(java.lang.Object obj)
Note: since PublicKey objects are mutable (because of the copy
method), it was a mistake to override equals
. Also,
equals
and hashCode
should always be overridden
together.
equals
in class java.lang.Object
obj
- object to testpublic final byte[] id()
public final byte[] fingerPrint()
WARNING: because the lengths of n and e are not encoded, it is feasible to create distinct keys with the same fingerprint. See http://www.hotlava.com/doc/fag-pgp/.
public final int bitLength()
public BigInteger encrypt(BigInteger plain)
Note: using RSA directly without random padding can be insecure.
plain
- the number to encrypt.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |