📄 dhpubkey.java
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -