Java 8 DHPublicKeySpec - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DHPublicKeySpec class.

This code example shows how to use the following methods:getG, getP, getY
import org.bouncycastle.asn1.DERObjectIdentifier; 
import org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers; 
import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 
import org.bouncycastle.asn1.pkcs.RSAPrivateKeyStructure; 
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 
import org.bouncycastle.asn1.x9.X9ObjectIdentifiers; 
// BEGIN android-removed 
// import org.bouncycastle.jce.interfaces.ElGamalPrivateKey; 
// import org.bouncycastle.jce.interfaces.ElGamalPublicKey; 
// import org.bouncycastle.jce.spec.ElGamalPrivateKeySpec; 
// import org.bouncycastle.jce.spec.ElGamalPublicKeySpec; 
// import org.bouncycastle.jce.spec.GOST3410PrivateKeySpec; 
// import org.bouncycastle.jce.spec.GOST3410PublicKeySpec; 
// END android-removed 
 
public abstract class JDKKeyFactory 
    extends KeyFactorySpi
8
CodeRank
This code example shows how to use the following methods:getG, getP, getY
        Class spec)
        throws InvalidKeySpecException 
    { 
        if (spec.isAssignableFrom(DHPrivateKeySpec.class) && key instanceof DHPrivateKey)
        { 
            DHPrivateKey k = (DHPrivateKey)key;
 
            return new DHPrivateKeySpec(k.getX(), k.getParams().getP(), k.getParams().getG());
        } 
        else if (spec.isAssignableFrom(DHPublicKeySpec.class) && key instanceof DHPublicKey)
        { 
            DHPublicKey k = (DHPublicKey)key;
 
            return new DHPublicKeySpec(k.getY(), k.getParams().getP(), k.getParams().getG());
        } 
 
        return super.engineGetKeySpec(key, spec);
    } 
 
    protected Key engineTranslateKey(
7
CodeRank
This code example shows how to use the following methods:getG, getP, getY
    } 
 
    JCEElGamalPublicKey( 
        DHPublicKeySpec    spec)
    { 
        this.y = spec.getY();
        this.elSpec = new ElGamalParameterSpec(spec.getP(), spec.getG());
    } 
     
    JCEElGamalPublicKey( 
        ElGamalPublicKey    key)
    { 
        this.y = key.getY();
        this.elSpec = key.getParameters();
    } 
 
    JCEElGamalPublicKey( 
        DHPublicKey    key)
    { 
        this.y = key.getY();
7
CodeRank
This code example shows how to use the following methods:getG, getP, getY
        throws InvalidKeySpecException 
    { 
        if (keySpec instanceof ElGamalPrivateKeySpec)
        { 
            return new BCElGamalPrivateKey((ElGamalPrivateKeySpec)keySpec);
        } 
        else if (keySpec instanceof DHPrivateKeySpec)
        { 
            return new BCElGamalPrivateKey((DHPrivateKeySpec)keySpec);
        } 
 
        return super.engineGeneratePrivate(keySpec);
    } 
 
    protected PublicKey engineGeneratePublic(
        KeySpec keySpec)
        throws InvalidKeySpecException 
    { 
        if (keySpec instanceof ElGamalPublicKeySpec)
        { 
7
CodeRank
This code example shows how to use the following methods:getG, getP, getY
    } 
 
    BCElGamalPublicKey( 
        DHPublicKeySpec spec)
    { 
        this.y = spec.getY();
        this.elSpec = new ElGamalParameterSpec(spec.getP(), spec.getG());
    } 
     
    BCElGamalPublicKey( 
        ElGamalPublicKey key)
    { 
        this.y = key.getY();
        this.elSpec = key.getParameters();
    } 
 
    BCElGamalPublicKey( 
        DHPublicKey key)
    { 
        this.y = key.getY();
7
CodeRank
This code example shows how to use the following methods:getG, getP, getY
    private SubjectPublicKeyInfo    info;
     
    JCEDHPublicKey( 
        DHPublicKeySpec    spec)
    { 
        this.y = spec.getY();
        this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG());
    } 
 
    JCEDHPublicKey( 
        DHPublicKey    key)
    { 
        this.y = key.getY();
        this.dhSpec = key.getParams();
    } 
 
    JCEDHPublicKey( 
        DHPublicKeyParameters  params)
    { 
        this.y = params.getY();
7
CodeRank
This code example shows how to use the following methods:getG, getP, getY
    private transient SubjectPublicKeyInfo    info;
     
    BCDHPublicKey( 
        DHPublicKeySpec spec)
    { 
        this.y = spec.getY();
        this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG());
    } 
 
    BCDHPublicKey( 
        DHPublicKey key)
    { 
        this.y = key.getY();
        this.dhSpec = key.getParams();
    } 
 
    BCDHPublicKey( 
        DHPublicKeyParameters params)
    { 
        this.y = params.getY();
7
CodeRank
This code example shows how to use the following methods:getG, getP, getY
        Class spec)
        throws InvalidKeySpecException 
    { 
        if (spec.isAssignableFrom(DHPrivateKeySpec.class) && key instanceof DHPrivateKey)
        { 
            DHPrivateKey k = (DHPrivateKey)key;
 
            return new DHPrivateKeySpec(k.getX(), k.getParams().getP(), k.getParams().getG());
        } 
        else if (spec.isAssignableFrom(DHPublicKeySpec.class) && key instanceof DHPublicKey)
        { 
            DHPublicKey k = (DHPublicKey)key;
 
            return new DHPublicKeySpec(k.getY(), k.getParams().getP(), k.getParams().getG());
        } 
 
        return super.engineGetKeySpec(key, spec);
    } 
 
    protected Key engineTranslateKey(
6
CodeRank
This code example shows how to use the following methods:getG, getP, getY
    private SubjectPublicKeyInfo    info;
     
    JCEDHPublicKey( 
        DHPublicKeySpec    spec)
    { 
        this.y = spec.getY();
        this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG());
    } 
 
    JCEDHPublicKey( 
        DHPublicKey    key)
    { 
        this.y = key.getY();
        this.dhSpec = key.getParams();
    } 
 
    JCEDHPublicKey( 
        DHPublicKeyParameters  params)
    { 
        this.y = params.getY();
6
CodeRank
This code example shows how to use the following methods:getG, getP, getY
    private transient SubjectPublicKeyInfo    info;
     
    BCDHPublicKey( 
        DHPublicKeySpec spec)
    { 
        this.y = spec.getY();
        this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG());
    } 
 
    BCDHPublicKey( 
        DHPublicKey key)
    { 
        this.y = key.getY();
        this.dhSpec = key.getParams();
    } 
 
    BCDHPublicKey( 
        DHPublicKeyParameters params)
    { 
        this.y = params.getY();
6
CodeRank
See Code Examples for Java 8 DHPublicKeySpec Methods: