Class RSAPublicKey
- java.lang.Object
-
- org.mozilla.jss.netscape.security.x509.X509Key
-
- org.mozilla.jss.netscape.security.provider.RSAPublicKey
-
- All Implemented Interfaces:
java.io.Serializable
,java.security.Key
,java.security.PublicKey
public final class RSAPublicKey extends X509Key implements java.io.Serializable
An X.509 public key for the RSA Algorithm.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.mozilla.jss.netscape.security.x509.X509Key
algid, encodedKey, key
-
-
Constructor Summary
Constructors Constructor Description RSAPublicKey()
RSAPublicKey(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
bigIntEquals(BigInt x, BigInt y)
boolean
equals(java.lang.Object obj)
int
getKeySize()
Get key size as number of bits in modulus (Always rounded up to a multiple of 8)BigInt
getModulus()
Get the raw modulusBigInt
getPublicExponent()
Get the raw public exponentint
hashCode()
Calculates a hash code value for the object.protected void
parseKeyBits()
Parse the key bits.java.lang.String
toString()
-
Methods inherited from class org.mozilla.jss.netscape.security.x509.X509Key
decode, decode, encode, encode, getAlgorithm, getAlgorithmId, getEncoded, getFormat, getKey, parse, parsePublicKey
-
-
-
-
Constructor Detail
-
RSAPublicKey
public RSAPublicKey()
-
RSAPublicKey
public RSAPublicKey(BigInt modulus, BigInt publicExponent) throws java.security.InvalidKeyException
Make a RSA public key out of a public exponent and modulus- Throws:
java.security.InvalidKeyException
-
RSAPublicKey
public RSAPublicKey(byte[] encoded) throws java.security.InvalidKeyException
Make a RSA public key from its DER encoding (X.509).- Throws:
java.security.InvalidKeyException
-
-
Method Detail
-
getKeySize
public int getKeySize()
Get key size as number of bits in modulus (Always rounded up to a multiple of 8)
-
getPublicExponent
public BigInt getPublicExponent()
Get the raw public exponent
-
getModulus
public BigInt getModulus()
Get the raw modulus
-
parseKeyBits
protected void parseKeyBits() throws java.security.InvalidKeyException
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:
java.security.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.
-
-