Class RSAPublicKey
java.lang.Object
org.mozilla.jss.netscape.security.x509.X509Key
org.mozilla.jss.netscape.security.provider.RSAPublicKey
- All Implemented Interfaces:
Serializable
,Key
,PublicKey
An X.509 public key for the RSA Algorithm.
- Version:
- $Revision$, $Date$
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ObjectIdentifier
private BigInt
private BigInt
private static final long
Fields inherited from class org.mozilla.jss.netscape.security.x509.X509Key
algid, encodedKey, key
-
Constructor Summary
ConstructorsConstructorDescriptionRSAPublicKey
(byte[] encoded) Make a RSA public key from its DER encoding (X.509).RSAPublicKey
(BigInt modulus, BigInt publicExponent) Make a RSA public key out of a public exponent and modulus -
Method Summary
Modifier and TypeMethodDescriptionboolean
bigIntEquals
(BigInt x, BigInt y) boolean
int
Get key size as number of bits in modulus (Always rounded up to a multiple of 8)Get the raw modulusGet the raw public exponentint
hashCode()
Calculates a hash code value for the object.protected void
Parse the key bits.toString()
Methods inherited from class org.mozilla.jss.netscape.security.x509.X509Key
decode, decode, encode, encode, getAlgorithm, getAlgorithmId, getEncoded, getFormat, getKey, parse, parsePublicKey
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
ALGORITHM_OID
-
modulus
-
publicExponent
-
-
Constructor Details
-
RSAPublicKey
public RSAPublicKey() -
RSAPublicKey
Make a RSA public key out of a public exponent and modulus- Throws:
InvalidKeyException
-
RSAPublicKey
Make a RSA public key from its DER encoding (X.509).- Throws:
InvalidKeyException
-
-
Method Details
-
getKeySize
public int getKeySize()Get key size as number of bits in modulus (Always rounded up to a multiple of 8) -
getPublicExponent
Get the raw public exponent -
getModulus
Get the raw modulus -
toString
-
parseKeyBits
Description copied from class:X509Key
Parse the key bits. This may be redefined by subclasses to take advantage of structure within the key. For example, RSA public keys encapsulate two unsigned integers (modulus and exponent) as DER values within thekey
bits; Diffie-Hellman and DSS/DSA keys encapsulate a single unsigned integer.This function is called when creating X.509 SubjectPublicKeyInfo values using the X509Key member functions, such as
parse
anddecode
.- Overrides:
parseKeyBits
in classX509Key
- Throws:
InvalidKeyException
- on invalid key encodings.
-
hashCode
public int hashCode()Description copied from class:X509Key
Calculates a hash code value for the object. Objects which are equal will also have the same hashcode. -
equals
-
bigIntEquals
-