⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rsaprivkey.java

📁 面向应用的智能安全代理平台和工具包是一个综合网络应用的安全共性需求而设计和实现的一个通用性的网络信息安全应用支撑平台
💻 JAVA
字号:
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);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -