dhpubkey.java

来自「DNS Java 是java实现的DNS」· Java 代码 · 共 73 行

JAVA
73
字号
// Copyright (c) 1999-2004 Brian Wellington (bwelling@xbill.org)package org.xbill.DNS.security;import java.math.*;import javax.crypto.interfaces.*;import javax.crypto.spec.*;/** * A stub implementation of a Diffie-Hellman public key * * @author Brian Wellington */class DHPubKey implements DHPublicKey {private DHParameterSpec params;private BigInteger Y;/** Create a Diffie-Hellman public key from its parts */publicDHPubKey(BigInteger p, BigInteger g, BigInteger y) {	params = new DHParameterSpec(p, g);	Y = y;}/** Obtain the public value of a Diffie-Hellman public key */public BigIntegergetY() {	return Y;}/** Obtain the parameters of a Diffie-Hellman public key */public DHParameterSpecgetParams() {	return params;}/** Obtain the algorithm of a Diffie-Hellman public key */public StringgetAlgorithm() {	return "DH";}/** Obtain the format of a Diffie-Hellman public key (unimplemented) */public StringgetFormat() {	return null;}/** * Obtain the encoded representation of a Diffie-Hellman public key * (unimplemented) */public byte []getEncoded() {	return null;}public StringtoString() {	StringBuffer sb = new StringBuffer();	sb.append("P = ");	sb.append(params.getP());	sb.append("\nG = ");	sb.append(params.getG());	sb.append("\nY = ");	sb.append(Y);	return sb.toString();}}

⌨️ 快捷键说明

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