📄 dhutil.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: DHUtil.java
package org.bouncycastle.jce.provider;
import java.security.*;
import javax.crypto.interfaces.DHPrivateKey;
import javax.crypto.interfaces.DHPublicKey;
import javax.crypto.spec.DHParameterSpec;
import org.bouncycastle.crypto.params.*;
public class DHUtil
{
public DHUtil()
{
}
public static AsymmetricKeyParameter generatePublicKeyParameter(PublicKey key)
throws InvalidKeyException
{
if (key instanceof DHPublicKey)
{
DHPublicKey k = (DHPublicKey)key;
return new DHPublicKeyParameters(k.getY(), new DHParameters(k.getParams().getP(), k.getParams().getG(), null, k.getParams().getL()));
} else
{
throw new InvalidKeyException("can't identify DH public key.");
}
}
public static AsymmetricKeyParameter generatePrivateKeyParameter(PrivateKey key)
throws InvalidKeyException
{
if (key instanceof DHPrivateKey)
{
DHPrivateKey k = (DHPrivateKey)key;
return new DHPrivateKeyParameters(k.getX(), new DHParameters(k.getParams().getP(), k.getParams().getG(), null, k.getParams().getL()));
} else
{
throw new InvalidKeyException("can't identify DH private key.");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -