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

ECUtil

public class ECUtil extends Object
utility class for converting jce/jca ECDSA, ECDH, and ECDHC 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 ECPrivateKey)
        {
            ECPrivateKey    k = (ECPrivateKey)key;
            ECParameterSpec s = k.getParams();

            return new ECPrivateKeyParameters(
                            k.getD(),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN()));
        }
                        
        throw new InvalidKeyException("can't identify EC private key.");
    
public static org.bouncycastle.crypto.params.AsymmetricKeyParametergeneratePublicKeyParameter(java.security.PublicKey key)

        if (key instanceof ECPublicKey)
        {
            ECPublicKey    k = (ECPublicKey)key;
            ECParameterSpec s = k.getParams();

            return new ECPublicKeyParameters(
                            k.getQ(),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN()));
        }

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