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 booleanbigIntEquals(BigInt x, BigInt y)booleanequals(java.lang.Object obj)intgetKeySize()Get key size as number of bits in modulus (Always rounded up to a multiple of 8)BigIntgetModulus()Get the raw modulusBigIntgetPublicExponent()Get the raw public exponentinthashCode()Calculates a hash code value for the object.protected voidparseKeyBits()Parse the key bits.java.lang.StringtoString()-
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.InvalidKeyExceptionMake 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.InvalidKeyExceptionDescription copied from class:X509KeyParse 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 thekeybits; 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
parseanddecode.- Overrides:
parseKeyBitsin classX509Key- Throws:
java.security.InvalidKeyException- on invalid key encodings.
-
hashCode
public int hashCode()
Description copied from class:X509KeyCalculates a hash code value for the object. Objects which are equal will also have the same hashcode.
-
-