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

📄 dhprivkey.java

📁 面向应用的智能安全代理平台和工具包是一个综合网络应用的安全共性需求而设计和实现的一个通用性的网络信息安全应用支撑平台
💻 JAVA
字号:
package au.net.aba.crypto.provider;

/*
 * $Id: DHPrivKey.java,v 1.7 1999/02/17 01:43:06 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/DHPrivKey.java,v $
 * $Revision: 1.7 $
 * $Date: 1999/02/17 01:43:06 $
 * $State: Exp $
 */
import java.math.*;
import java.security.*;

import javax.crypto.spec.*;
import javax.crypto.interfaces.*;

/**
 * a class representing a Diffie-Hellman private key - note: INCOMPLETE.
 */
public class DHPrivKey
	implements DHPrivateKey
{
	public final static String ident = "$Id: DHPrivKey.java,v 1.7 1999/02/17 01:43:06 leachbj Exp $";

	private BigInteger	x;
	private BigInteger	p;
	private BigInteger	g;
	private int		l;

	DHPrivKey(
		BigInteger	x,
		BigInteger	p,
		BigInteger	g)
	{
		this.x = x;
		this.p = p;
		this.g = g;
		this.l = x.bitLength();
	}
	DHPrivKey(
		BigInteger	x,
		BigInteger	p,
		BigInteger	g,
		int		l)
	{
		this.x = x;
		this.p = p;
		this.g = g;
		this.l = l;
	}
	/**
	 * return the algorithm for this key.
	 */
	public String getAlgorithm()
	{
		return "DH";
	}
	/**
	 * return an encoded representation for this key.
	 */
	public byte[] getEncoded()
	{
		throw new RuntimeException("DHPrivKey: getEncoded - not implemented");
	}
	/**
	 * return the format this key is in.
	 */
	public String getFormat()
	{
		return "ABA";
	}
	/**
	 * Returns the key parameters.
	 *
	 * @return the key parameters.
	 */
	public DHParameterSpec getParams()
	{
		return new DHParameterSpec(p, g, l);
	}
	/**
	 * Returns the private value, x.
	 * 
	 * @return the private value, x
	 */
	public BigInteger getX()
	{
		return x;
	}
}

⌨️ 快捷键说明

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