Java Code Examples for java.security.interfaces.DSAParams#getQ()
The following examples show how to use
java.security.interfaces.DSAParams#getQ() .
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: BasicChecker.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Internal method to create a new key with inherited key parameters. * * @param keyValueKey key from which to obtain key value * @param keyParamsKey key from which to obtain key parameters * @return new public key having value and parameters * @throws CertPathValidatorException if keys are not appropriate types * for this operation */ static PublicKey makeInheritedParamsKey(PublicKey keyValueKey, PublicKey keyParamsKey) throws CertPathValidatorException { if (!(keyValueKey instanceof DSAPublicKey) || !(keyParamsKey instanceof DSAPublicKey)) throw new CertPathValidatorException("Input key is not " + "appropriate type for " + "inheriting parameters"); DSAParams params = ((DSAPublicKey)keyParamsKey).getParams(); if (params == null) throw new CertPathValidatorException("Key parameters missing"); try { BigInteger y = ((DSAPublicKey)keyValueKey).getY(); KeyFactory kf = KeyFactory.getInstance("DSA"); DSAPublicKeySpec ks = new DSAPublicKeySpec(y, params.getP(), params.getQ(), params.getG()); return kf.generatePublic(ks); } catch (GeneralSecurityException e) { throw new CertPathValidatorException("Unable to generate key with" + " inherited parameters: " + e.getMessage(), e); } }
Example 2
Source File: BasicChecker.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Internal method to create a new key with inherited key parameters. * * @param keyValueKey key from which to obtain key value * @param keyParamsKey key from which to obtain key parameters * @return new public key having value and parameters * @throws CertPathValidatorException if keys are not appropriate types * for this operation */ static PublicKey makeInheritedParamsKey(PublicKey keyValueKey, PublicKey keyParamsKey) throws CertPathValidatorException { if (!(keyValueKey instanceof DSAPublicKey) || !(keyParamsKey instanceof DSAPublicKey)) throw new CertPathValidatorException("Input key is not " + "appropriate type for " + "inheriting parameters"); DSAParams params = ((DSAPublicKey)keyParamsKey).getParams(); if (params == null) throw new CertPathValidatorException("Key parameters missing"); try { BigInteger y = ((DSAPublicKey)keyValueKey).getY(); KeyFactory kf = KeyFactory.getInstance("DSA"); DSAPublicKeySpec ks = new DSAPublicKeySpec(y, params.getP(), params.getQ(), params.getG()); return kf.generatePublic(ks); } catch (GeneralSecurityException e) { throw new CertPathValidatorException("Unable to generate key with" + " inherited parameters: " + e.getMessage(), e); } }
Example 3
Source File: BasicChecker.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Internal method to create a new key with inherited key parameters. * * @param keyValueKey key from which to obtain key value * @param keyParamsKey key from which to obtain key parameters * @return new public key having value and parameters * @throws CertPathValidatorException if keys are not appropriate types * for this operation */ static PublicKey makeInheritedParamsKey(PublicKey keyValueKey, PublicKey keyParamsKey) throws CertPathValidatorException { if (!(keyValueKey instanceof DSAPublicKey) || !(keyParamsKey instanceof DSAPublicKey)) throw new CertPathValidatorException("Input key is not " + "appropriate type for " + "inheriting parameters"); DSAParams params = ((DSAPublicKey)keyParamsKey).getParams(); if (params == null) throw new CertPathValidatorException("Key parameters missing"); try { BigInteger y = ((DSAPublicKey)keyValueKey).getY(); KeyFactory kf = KeyFactory.getInstance("DSA"); DSAPublicKeySpec ks = new DSAPublicKeySpec(y, params.getP(), params.getQ(), params.getG()); return kf.generatePublic(ks); } catch (GeneralSecurityException e) { throw new CertPathValidatorException("Unable to generate key with" + " inherited parameters: " + e.getMessage(), e); } }
Example 4
Source File: BasicChecker.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Internal method to create a new key with inherited key parameters. * * @param keyValueKey key from which to obtain key value * @param keyParamsKey key from which to obtain key parameters * @return new public key having value and parameters * @throws CertPathValidatorException if keys are not appropriate types * for this operation */ static PublicKey makeInheritedParamsKey(PublicKey keyValueKey, PublicKey keyParamsKey) throws CertPathValidatorException { if (!(keyValueKey instanceof DSAPublicKey) || !(keyParamsKey instanceof DSAPublicKey)) throw new CertPathValidatorException("Input key is not " + "appropriate type for " + "inheriting parameters"); DSAParams params = ((DSAPublicKey)keyParamsKey).getParams(); if (params == null) throw new CertPathValidatorException("Key parameters missing"); try { BigInteger y = ((DSAPublicKey)keyValueKey).getY(); KeyFactory kf = KeyFactory.getInstance("DSA"); DSAPublicKeySpec ks = new DSAPublicKeySpec(y, params.getP(), params.getQ(), params.getG()); return kf.generatePublic(ks); } catch (GeneralSecurityException e) { throw new CertPathValidatorException("Unable to generate key with" + " inherited parameters: " + e.getMessage(), e); } }
Example 5
Source File: BasicChecker.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Internal method to create a new key with inherited key parameters. * * @param keyValueKey key from which to obtain key value * @param keyParamsKey key from which to obtain key parameters * @return new public key having value and parameters * @throws CertPathValidatorException if keys are not appropriate types * for this operation */ static PublicKey makeInheritedParamsKey(PublicKey keyValueKey, PublicKey keyParamsKey) throws CertPathValidatorException { if (!(keyValueKey instanceof DSAPublicKey) || !(keyParamsKey instanceof DSAPublicKey)) throw new CertPathValidatorException("Input key is not " + "appropriate type for " + "inheriting parameters"); DSAParams params = ((DSAPublicKey)keyParamsKey).getParams(); if (params == null) throw new CertPathValidatorException("Key parameters missing"); try { BigInteger y = ((DSAPublicKey)keyValueKey).getY(); KeyFactory kf = KeyFactory.getInstance("DSA"); DSAPublicKeySpec ks = new DSAPublicKeySpec(y, params.getP(), params.getQ(), params.getG()); return kf.generatePublic(ks); } catch (GeneralSecurityException e) { throw new CertPathValidatorException("Unable to generate key with" + " inherited parameters: " + e.getMessage(), e); } }
Example 6
Source File: BasicChecker.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Internal method to create a new key with inherited key parameters. * * @param keyValueKey key from which to obtain key value * @param keyParamsKey key from which to obtain key parameters * @return new public key having value and parameters * @throws CertPathValidatorException if keys are not appropriate types * for this operation */ static PublicKey makeInheritedParamsKey(PublicKey keyValueKey, PublicKey keyParamsKey) throws CertPathValidatorException { if (!(keyValueKey instanceof DSAPublicKey) || !(keyParamsKey instanceof DSAPublicKey)) throw new CertPathValidatorException("Input key is not " + "appropriate type for " + "inheriting parameters"); DSAParams params = ((DSAPublicKey)keyParamsKey).getParams(); if (params == null) throw new CertPathValidatorException("Key parameters missing"); try { BigInteger y = ((DSAPublicKey)keyValueKey).getY(); KeyFactory kf = KeyFactory.getInstance("DSA"); DSAPublicKeySpec ks = new DSAPublicKeySpec(y, params.getP(), params.getQ(), params.getG()); return kf.generatePublic(ks); } catch (GeneralSecurityException e) { throw new CertPathValidatorException("Unable to generate key with" + " inherited parameters: " + e.getMessage(), e); } }
Example 7
Source File: DSAKeyPairGenerator.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Initializes the DSA object using a DSA parameter object. * * @param params a fully initialized DSA parameter object. */ public void initialize(DSAParams params, SecureRandom random) { if (params == null) { throw new InvalidParameterException("Params must not be null"); } DSAParameterSpec spec = new DSAParameterSpec (params.getP(), params.getQ(), params.getG()); initialize0(spec, random); }
Example 8
Source File: DOMKeyValue.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
DSA(PublicKey key) throws KeyException { super(key); DSAPublicKey dkey = (DSAPublicKey) key; DSAParams params = dkey.getParams(); p = new DOMCryptoBinary(params.getP()); q = new DOMCryptoBinary(params.getQ()); g = new DOMCryptoBinary(params.getG()); y = new DOMCryptoBinary(dkey.getY()); }
Example 9
Source File: DSAKeyPairGenerator.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Initializes the DSA object using a DSA parameter object. * * @param params a fully initialized DSA parameter object. */ @Override public void initialize(DSAParams params, SecureRandom random) throws InvalidParameterException { if (params == null) { throw new InvalidParameterException("Params must not be null"); } DSAParameterSpec spec = new DSAParameterSpec (params.getP(), params.getQ(), params.getG()); super.init(spec, random, false); }
Example 10
Source File: DSAKeyPairGenerator.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * Initializes the DSA object using a DSA parameter object. * * @param params a fully initialized DSA parameter object. */ @Override public void initialize(DSAParams params, SecureRandom random) throws InvalidParameterException { if (params == null) { throw new InvalidParameterException("Params must not be null"); } DSAParameterSpec spec = new DSAParameterSpec (params.getP(), params.getQ(), params.getG()); super.init(spec, random, false); }
Example 11
Source File: DSAKeyPairGenerator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Initializes the DSA object using a DSA parameter object. * * @param params a fully initialized DSA parameter object. */ public void initialize(DSAParams params, SecureRandom random) { if (params == null) { throw new InvalidParameterException("Params must not be null"); } DSAParameterSpec spec = new DSAParameterSpec (params.getP(), params.getQ(), params.getG()); initialize0(spec, random); }
Example 12
Source File: DSAKeyPairGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Initializes the DSA object using a DSA parameter object. * * @param params a fully initialized DSA parameter object. */ @Override public void initialize(DSAParams params, SecureRandom random) throws InvalidParameterException { if (params == null) { throw new InvalidParameterException("Params must not be null"); } DSAParameterSpec spec = new DSAParameterSpec (params.getP(), params.getQ(), params.getG()); super.init(spec, random, false); }
Example 13
Source File: DOMKeyValue.java From hottub with GNU General Public License v2.0 | 5 votes |
DSA(PublicKey key) throws KeyException { super(key); DSAPublicKey dkey = (DSAPublicKey) key; DSAParams params = dkey.getParams(); p = new DOMCryptoBinary(params.getP()); q = new DOMCryptoBinary(params.getQ()); g = new DOMCryptoBinary(params.getG()); y = new DOMCryptoBinary(dkey.getY()); }
Example 14
Source File: DOMKeyValue.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
DSA(PublicKey key) throws KeyException { super(key); DSAPublicKey dkey = (DSAPublicKey) key; DSAParams params = dkey.getParams(); p = new DOMCryptoBinary(params.getP()); q = new DOMCryptoBinary(params.getQ()); g = new DOMCryptoBinary(params.getG()); y = new DOMCryptoBinary(dkey.getY()); }
Example 15
Source File: DSAKeyPairGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Initializes the DSA object using a DSA parameter object. * * @param params a fully initialized DSA parameter object. */ public void initialize(DSAParams params, SecureRandom random) { if (params == null) { throw new InvalidParameterException("Params must not be null"); } DSAParameterSpec spec = new DSAParameterSpec (params.getP(), params.getQ(), params.getG()); initialize0(spec, random); }
Example 16
Source File: DOMKeyValue.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
DSA(PublicKey key) throws KeyException { super(key); DSAPublicKey dkey = (DSAPublicKey) key; DSAParams params = dkey.getParams(); p = new DOMCryptoBinary(params.getP()); q = new DOMCryptoBinary(params.getQ()); g = new DOMCryptoBinary(params.getG()); y = new DOMCryptoBinary(dkey.getY()); }
Example 17
Source File: DOMKeyValue.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
DSA(PublicKey key) throws KeyException { super(key); DSAPublicKey dkey = (DSAPublicKey) key; DSAParams params = dkey.getParams(); p = new DOMCryptoBinary(params.getP()); q = new DOMCryptoBinary(params.getQ()); g = new DOMCryptoBinary(params.getG()); y = new DOMCryptoBinary(dkey.getY()); }
Example 18
Source File: DSAKeyPairGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Initializes the DSA object using a DSA parameter object. * * @param params a fully initialized DSA parameter object. */ @Override public void initialize(DSAParams params, SecureRandom random) throws InvalidParameterException { if (params == null) { throw new InvalidParameterException("Params must not be null"); } DSAParameterSpec spec = new DSAParameterSpec (params.getP(), params.getQ(), params.getG()); super.init(spec, random, false); }
Example 19
Source File: DOMKeyValue.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
DSA(PublicKey key) throws KeyException { super(key); DSAPublicKey dkey = (DSAPublicKey) key; DSAParams params = dkey.getParams(); p = new DOMCryptoBinary(params.getP()); q = new DOMCryptoBinary(params.getQ()); g = new DOMCryptoBinary(params.getG()); y = new DOMCryptoBinary(dkey.getY()); }
Example 20
Source File: DSAKeyPairGenerator.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Initializes the DSA object using a DSA parameter object. * * @param params a fully initialized DSA parameter object. */ @Override public void initialize(DSAParams params, SecureRandom random) throws InvalidParameterException { if (params == null) { throw new InvalidParameterException("Params must not be null"); } DSAParameterSpec spec = new DSAParameterSpec (params.getP(), params.getQ(), params.getG()); super.init(spec, random, false); }