Methods Summary |
---|
public boolean | equals(java.lang.Object o)
if ( !(o instanceof RSAPublicKey) )
{
return false;
}
if ( o == this )
{
return true;
}
RSAPublicKey key = (RSAPublicKey)o;
return getModulus().equals(key.getModulus())
&& getPublicExponent().equals(key.getPublicExponent());
|
public java.lang.String | getAlgorithm()
return "RSA";
|
public byte[] | getEncoded()
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
DEROutputStream dOut = new DEROutputStream(bOut);
SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, new DERNull()), new RSAPublicKeyStructure(getModulus(), getPublicExponent()).getDERObject());
try
{
dOut.writeObject(info);
dOut.close();
}
catch (IOException e)
{
throw new RuntimeException("Error encoding RSA public key");
}
return bOut.toByteArray();
|
public java.lang.String | getFormat()
return "X.509";
|
public java.math.BigInteger | getModulus()return the modulus.
return modulus;
|
public java.math.BigInteger | getPublicExponent()return the public exponent.
return publicExponent;
|
public java.lang.String | toString()
StringBuffer buf = new StringBuffer();
String nl = System.getProperty("line.separator");
buf.append("RSA Public Key" + nl);
buf.append(" modulus: " + this.getModulus().toString(16) + nl);
buf.append(" public exponent: " + this.getPublicExponent().toString(16) + nl);
return buf.toString();
|