Java Code Examples for javax.crypto.spec.DHPrivateKeySpec#getG()
The following examples show how to use
javax.crypto.spec.DHPrivateKeySpec#getG() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DHKeyFactory.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 2
Source File: DHKeyFactory.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 3
Source File: DHKeyFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 4
Source File: DHKeyFactory.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 5
Source File: DHKeyFactory.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 6
Source File: DHKeyFactory.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 7
Source File: DHKeyFactory.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 8
Source File: DHKeyFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 9
Source File: DHKeyFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 10
Source File: DHKeyFactory.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 11
Source File: DHKeyFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 12
Source File: DHKeyFactory.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 13
Source File: DHKeyFactory.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Generates a private key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the private key * * @return the private key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a private key. */ protected PrivateKey engineGeneratePrivate(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DHPrivateKeySpec) { DHPrivateKeySpec dhPrivKeySpec = (DHPrivateKeySpec)keySpec; return new DHPrivateKey(dhPrivKeySpec.getX(), dhPrivKeySpec.getP(), dhPrivKeySpec.getG()); } else if (keySpec instanceof PKCS8EncodedKeySpec) { return new DHPrivateKey (((PKCS8EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification", e); } }
Example 14
Source File: BCElGamalPrivateKey.java From ripple-lib-java with ISC License | 4 votes |
BCElGamalPrivateKey( DHPrivateKeySpec spec) { this.x = spec.getX(); this.elSpec = new ElGamalParameterSpec(spec.getP(), spec.getG()); }
Example 15
Source File: JCEElGamalPrivateKey.java From RipplePower with Apache License 2.0 | 4 votes |
JCEElGamalPrivateKey( DHPrivateKeySpec spec) { this.x = spec.getX(); this.elSpec = new ElGamalParameterSpec(spec.getP(), spec.getG()); }
Example 16
Source File: JCEDHPrivateKey.java From RipplePower with Apache License 2.0 | 4 votes |
JCEDHPrivateKey( DHPrivateKeySpec spec) { this.x = spec.getX(); this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG()); }
Example 17
Source File: BCDHPrivateKey.java From RipplePower with Apache License 2.0 | 4 votes |
BCDHPrivateKey( DHPrivateKeySpec spec) { this.x = spec.getX(); this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG()); }
Example 18
Source File: BCDHPrivateKey.java From ripple-lib-java with ISC License | 4 votes |
BCDHPrivateKey( DHPrivateKeySpec spec) { this.x = spec.getX(); this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG()); }
Example 19
Source File: JCEElGamalPrivateKey.java From ripple-lib-java with ISC License | 4 votes |
JCEElGamalPrivateKey( DHPrivateKeySpec spec) { this.x = spec.getX(); this.elSpec = new ElGamalParameterSpec(spec.getP(), spec.getG()); }
Example 20
Source File: JCEDHPrivateKey.java From ripple-lib-java with ISC License | 4 votes |
JCEDHPrivateKey( DHPrivateKeySpec spec) { this.x = spec.getX(); this.dhSpec = new DHParameterSpec(spec.getP(), spec.getG()); }