Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.security.key.rsa
Class GnuRSAKey  view GnuRSAKey download GnuRSAKey.java

java.lang.Object
  extended bygnu.java.security.key.rsa.GnuRSAKey
All Implemented Interfaces:
java.security.Key, java.security.interfaces.RSAKey, java.io.Serializable
Direct Known Subclasses:
GnuRSAPrivateKey, GnuRSAPublicKey

public abstract class GnuRSAKey
extends java.lang.Object
implements java.security.Key, java.security.interfaces.RSAKey

A base asbtract class for both public and private RSA keys.


Field Summary
protected  int defaultFormat
          Identifier of the default encoding format to use when externalizing the key material.
private  java.math.BigInteger e
          The public exponent of an RSA key pair.
private  java.math.BigInteger n
          The public modulus of an RSA key pair.
private  java.lang.String str
          String representation of this key.
 
Fields inherited from interface java.security.Key
serialVersionUID
 
Constructor Summary
protected GnuRSAKey(int defaultFormat, java.math.BigInteger n, java.math.BigInteger e)
          Trivial protected constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the designated object is an instance of java.security.interfaces.RSAKey and has the same RSA parameter values as this one.
 java.lang.String getAlgorithm()
          This method returns the name of the algorithm for this key.
 java.math.BigInteger getE()
          Same as getPublicExponent() 55 .
 byte[] getEncoded()
          This method returns the encoded form of the key.
abstract  byte[] getEncoded(int format)
           
 java.lang.String getFormat()
          This method returns the name of the encoding format for this key.
 java.math.BigInteger getModulus()
          Generates a modulus.
 java.math.BigInteger getN()
          Returns the modulus n.
 java.math.BigInteger getPublicExponent()
          Returns the public exponent e.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

n

private final java.math.BigInteger n
The public modulus of an RSA key pair.


e

private final java.math.BigInteger e
The public exponent of an RSA key pair.


defaultFormat

protected final int defaultFormat
Identifier of the default encoding format to use when externalizing the key material.


str

private transient java.lang.String str
String representation of this key. Cached for speed.

Constructor Detail

GnuRSAKey

protected GnuRSAKey(int defaultFormat,
                    java.math.BigInteger n,
                    java.math.BigInteger e)
Trivial protected constructor.

Method Detail

getModulus

public java.math.BigInteger getModulus()
Description copied from interface: java.security.interfaces.RSAKey
Generates a modulus.

Specified by:
getModulus in interface java.security.interfaces.RSAKey

getAlgorithm

public java.lang.String getAlgorithm()
Description copied from interface: java.security.Key
This method returns the name of the algorithm for this key. This is a String such as "RSA".

Specified by:
getAlgorithm in interface java.security.Key

getEncoded

public byte[] getEncoded()
Deprecated. see getEncoded(int).

Description copied from interface: java.security.Key
This method returns the encoded form of the key. If this key does not support encoding, this method returns null.

Specified by:
getEncoded in interface java.security.Key

getFormat

public java.lang.String getFormat()
Description copied from interface: java.security.Key
This method returns the name of the encoding format for this key. This is the name of the ASN.1 data format used for this key, such as "X.509" or "PKCS#8". This method returns null if this key does not have an encoding format.

Specified by:
getFormat in interface java.security.Key

getN

public java.math.BigInteger getN()

Returns the modulus n.


getPublicExponent

public java.math.BigInteger getPublicExponent()

Returns the public exponent e.


getE

public java.math.BigInteger getE()

Same as getPublicExponent() 55 .


equals

public boolean equals(java.lang.Object obj)

Returns true if the designated object is an instance of java.security.interfaces.RSAKey and has the same RSA parameter values as this one.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getEncoded

public abstract byte[] getEncoded(int format)