Java Code Examples for java.security.spec.DSAPublicKeySpec#getP()
The following examples show how to use
java.security.spec.DSAPublicKeySpec#getP() .
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: DSAKeyFactory.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else if (keySpec instanceof X509EncodedKeySpec) { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 2
Source File: DSAKeyFactory.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 3
Source File: DSAKeyFactory.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 4
Source File: DSAKeyFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 5
Source File: DSAKeyFactory.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 6
Source File: DSAKeyFactory.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 7
Source File: DSAKeyFactory.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 8
Source File: DSAKeyFactory.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 9
Source File: DSAKeyFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 10
Source File: DSAKeyFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 11
Source File: DSAKeyFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 12
Source File: DSAKeyFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 13
Source File: DSAKeyFactory.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 14
Source File: DSAKeyFactory.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Generates a public key object from the provided key specification * (key material). * * @param keySpec the specification (key material) of the public key * * @return the public key * * @exception InvalidKeySpecException if the given key specification * is inappropriate for this key factory to produce a public key. */ protected PublicKey engineGeneratePublic(KeySpec keySpec) throws InvalidKeySpecException { try { if (keySpec instanceof DSAPublicKeySpec) { DSAPublicKeySpec dsaPubKeySpec = (DSAPublicKeySpec)keySpec; if (SERIAL_INTEROP) { return new DSAPublicKey(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } else { return new DSAPublicKeyImpl(dsaPubKeySpec.getY(), dsaPubKeySpec.getP(), dsaPubKeySpec.getQ(), dsaPubKeySpec.getG()); } } else if (keySpec instanceof X509EncodedKeySpec) { if (SERIAL_INTEROP) { return new DSAPublicKey (((X509EncodedKeySpec)keySpec).getEncoded()); } else { return new DSAPublicKeyImpl (((X509EncodedKeySpec)keySpec).getEncoded()); } } else { throw new InvalidKeySpecException ("Inappropriate key specification"); } } catch (InvalidKeyException e) { throw new InvalidKeySpecException ("Inappropriate key specification: " + e.getMessage()); } }
Example 15
Source File: JDKDSAPublicKey.java From RipplePower with Apache License 2.0 | 4 votes |
JDKDSAPublicKey( DSAPublicKeySpec spec) { this.y = spec.getY(); this.dsaSpec = new DSAParameterSpec(spec.getP(), spec.getQ(), spec.getG()); }
Example 16
Source File: BCDSAPublicKey.java From RipplePower with Apache License 2.0 | 4 votes |
BCDSAPublicKey( DSAPublicKeySpec spec) { this.y = spec.getY(); this.dsaSpec = new DSAParameterSpec(spec.getP(), spec.getQ(), spec.getG()); }
Example 17
Source File: JDKDSAPublicKey.java From ripple-lib-java with ISC License | 4 votes |
JDKDSAPublicKey( DSAPublicKeySpec spec) { this.y = spec.getY(); this.dsaSpec = new DSAParameterSpec(spec.getP(), spec.getQ(), spec.getG()); }
Example 18
Source File: BCDSAPublicKey.java From ripple-lib-java with ISC License | 4 votes |
BCDSAPublicKey( DSAPublicKeySpec spec) { this.y = spec.getY(); this.dsaSpec = new DSAParameterSpec(spec.getP(), spec.getQ(), spec.getG()); }