FileDocCategorySizeDatePackage
DHUtil.javaAPI DocAzureus 3.0.3.41625Tue Jun 08 05:12:56 BST 2004org.bouncycastle.jce.provider

DHUtil

public class DHUtil extends Object
utility class for converting jce/jca DH objects objects into their org.bouncycastle.crypto counterparts.

Fields Summary
Constructors Summary
Methods Summary
public static org.bouncycastle.crypto.params.AsymmetricKeyParametergeneratePrivateKeyParameter(java.security.PrivateKey key)

        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()));
        }
                        
        throw new InvalidKeyException("can't identify DH private key.");
    
public static org.bouncycastle.crypto.params.AsymmetricKeyParametergeneratePublicKeyParameter(java.security.PublicKey key)

        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()));
        }

        throw new InvalidKeyException("can't identify DH public key.");