?? rsaprivkey.java
字號(hào):
package au.net.aba.crypto.provider;
/*
* $Id: RSAPrivKey.java,v 1.6 1999/01/24 23:03:51 leachbj Exp $
* $Author: leachbj $
*
* Copyright (C) 1996-1998 Australian Business Access Pty Ltd.
* All rights reserved.
*
* Use, modification, copying and distribution of this software is subject the
* terms and conditions of the ABA Public Licence. See the file
* "PUBLIC_LICENCE" for additional information.
*
* If you have not received a copy of the Public Licence, you must destroy all
* copies of this file immediately.
*
* $Source: /aba/CVSROOT/jdk1.1/src/au.net.aba/crypto/provider/RSAPrivKey.java,v $
* $Revision: 1.6 $
* $Date: 1999/01/24 23:03:51 $
* $State: Exp $
*/
import java.math.BigInteger;
import java.security.interfaces.RSAPrivateKey;
/**
* A class for ABA RSA private keys.
*/
public class RSAPrivKey implements RSAPrivateKey
{
public final static String ident = "$Id: RSAPrivKey.java,v 1.6 1999/01/24 23:03:51 leachbj Exp $";
//==================================
// Protected Interface
//==================================
/**
* The modulus of this key.
*/
protected BigInteger modulus;
/**
* The private exponent of this key.
*/
protected BigInteger d;
/**
* Construct an empty RSAPrivKey.
*/
public RSAPrivKey()
{
}
public RSAPrivKey(
BigInteger modulus,
BigInteger privateExponent)
{
this.modulus = modulus;
this.d = privateExponent;
}
/**
* Return the algorithm for this key.
*
* @return the string RSA.
*/
public String getAlgorithm()
{
return "RSA";
}
/**
* Return an encoded representation for this key. Returns a
* byte array that forms the string "modulus.exponent".
*
* @see #getFormat
* @see #toString
*/
public byte[] getEncoded()
{
return toString().getBytes();
}
/**
* Return the format this key is in. This returns "ABA" which
* indicates the encoded key is the form of a byte array whose
* contents form the string "modulus.exponent" (ie the String
* returned from the <code>toString()</code> method. This
* format is compatible with the AsciiEncodedKeySpec.
*/
public String getFormat()
{
return "ASCII";
}
//==================================
// Public Interface
//==================================
/**
* Return the modulus.
*
* @return the modulus.
*/
public BigInteger getModulus()
{
return modulus;
}
/**
* Return the private exponent
*
* @return the private exponent.
*/
public BigInteger getPrivateExponent()
{
return d;
}
/**
* Generate a String representation of this key.
*
* @return The key as a string.
*/
public String toString()
{
return modulus.toString(16) + "." + d.toString(16);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -