sun.security.internal.spec.TlsPrfParameterSpec Java Examples
The following examples show how to use
sun.security.internal.spec.TlsPrfParameterSpec.
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: P11TlsPrfGenerator.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #2
Source File: P11TlsPrfGenerator.java From hottub with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #3
Source File: P11TlsPrfGenerator.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #4
Source File: P11TlsPrfGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@SuppressWarnings("deprecation") protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #5
Source File: P11TlsPrfGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #6
Source File: P11TlsPrfGenerator.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #7
Source File: P11TlsPrfGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #8
Source File: P11TlsPrfGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #9
Source File: P11TlsPrfGenerator.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #10
Source File: P11TlsPrfGenerator.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #11
Source File: P11TlsPrfGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #12
Source File: P11TlsPrfGenerator.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #13
Source File: P11TlsPrfGenerator.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if (key == null) { key = NULL_KEY; } try { p11Key = P11SecretKeyFactory.convertKey(token, key, null); } catch (InvalidKeyException e) { throw new InvalidAlgorithmParameterException("init() failed", e); } }
Example #14
Source File: TlsPrfGenerator.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #15
Source File: TlsPrfGenerator.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #16
Source File: TlsPrfGenerator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #17
Source File: TlsPrfGenerator.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #18
Source File: TlsPrfGenerator.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #19
Source File: TlsPrfGenerator.java From hottub with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #20
Source File: TlsPrfGenerator.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #21
Source File: TlsPrfGenerator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("deprecation") protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #22
Source File: TlsPrfGenerator.java From Bytecoder with Apache License 2.0 | 5 votes |
@SuppressWarnings("deprecation") protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #23
Source File: TlsPrfGenerator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #24
Source File: TlsPrfGenerator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #25
Source File: TlsPrfGenerator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #26
Source File: TlsPrfGenerator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #27
Source File: TlsPrfGenerator.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { if (params instanceof TlsPrfParameterSpec == false) { throw new InvalidAlgorithmParameterException(MSG); } this.spec = (TlsPrfParameterSpec)params; SecretKey key = spec.getSecret(); if ((key != null) && ("RAW".equals(key.getFormat()) == false)) { throw new InvalidAlgorithmParameterException( "Key encoding format must be RAW"); } }
Example #28
Source File: Finished.java From Bytecoder with Apache License 2.0 | 4 votes |
@Override public byte[] createVerifyData(HandshakeContext context, boolean isValidation) throws IOException { CipherSuite cipherSuite = context.negotiatedCipherSuite; HandshakeHash handshakeHash = context.handshakeHash; SecretKey masterSecretKey = context.handshakeSession.getMasterSecret(); boolean useClientLabel = (context.sslConfig.isClientMode && !isValidation) || (!context.sslConfig.isClientMode && isValidation); String tlsLabel; if (useClientLabel) { tlsLabel = "client finished"; } else { tlsLabel = "server finished"; } try { byte[] seed = handshakeHash.digest(); String prfAlg = "SunTls12Prf"; HashAlg hashAlg = cipherSuite.hashAlg; /* * RFC 5246/7.4.9 says that finished messages can * be ciphersuite-specific in both length/PRF hash * algorithm. If we ever run across a different * length, this call will need to be updated. */ @SuppressWarnings("deprecation") TlsPrfParameterSpec spec = new TlsPrfParameterSpec( masterSecretKey, tlsLabel, seed, 12, hashAlg.name, hashAlg.hashLength, hashAlg.blockSize); KeyGenerator kg = KeyGenerator.getInstance(prfAlg); kg.init(spec); SecretKey prfKey = kg.generateKey(); if (!"RAW".equals(prfKey.getFormat())) { throw new ProviderException( "Invalid PRF output, format must be RAW. " + "Format received: " + prfKey.getFormat()); } byte[] finished = prfKey.getEncoded(); return finished; } catch (GeneralSecurityException e) { throw new RuntimeException("PRF failed", e); } }
Example #29
Source File: Finished.java From Bytecoder with Apache License 2.0 | 4 votes |
@Override public byte[] createVerifyData(HandshakeContext context, boolean isValidation) throws IOException { HandshakeHash handshakeHash = context.handshakeHash; SecretKey masterSecretKey = context.handshakeSession.getMasterSecret(); boolean useClientLabel = (context.sslConfig.isClientMode && !isValidation) || (!context.sslConfig.isClientMode && isValidation); String tlsLabel; if (useClientLabel) { tlsLabel = "client finished"; } else { tlsLabel = "server finished"; } try { byte[] seed = handshakeHash.digest(); String prfAlg = "SunTlsPrf"; HashAlg hashAlg = H_NONE; /* * RFC 5246/7.4.9 says that finished messages can * be ciphersuite-specific in both length/PRF hash * algorithm. If we ever run across a different * length, this call will need to be updated. */ @SuppressWarnings("deprecation") TlsPrfParameterSpec spec = new TlsPrfParameterSpec( masterSecretKey, tlsLabel, seed, 12, hashAlg.name, hashAlg.hashLength, hashAlg.blockSize); KeyGenerator kg = KeyGenerator.getInstance(prfAlg); kg.init(spec); SecretKey prfKey = kg.generateKey(); if (!"RAW".equals(prfKey.getFormat())) { throw new ProviderException( "Invalid PRF output, format must be RAW. " + "Format received: " + prfKey.getFormat()); } byte[] finished = prfKey.getEncoded(); return finished; } catch (GeneralSecurityException e) { throw new RuntimeException("PRF failed", e); } }
Example #30
Source File: Finished.java From openjsse with GNU General Public License v2.0 | 4 votes |
@Override public byte[] createVerifyData(HandshakeContext context, boolean isValidation) throws IOException { CipherSuite cipherSuite = context.negotiatedCipherSuite; HandshakeHash handshakeHash = context.handshakeHash; SecretKey masterSecretKey = context.handshakeSession.getMasterSecret(); boolean useClientLabel = (context.sslConfig.isClientMode && !isValidation) || (!context.sslConfig.isClientMode && isValidation); String tlsLabel; if (useClientLabel) { tlsLabel = "client finished"; } else { tlsLabel = "server finished"; } try { byte[] seed = handshakeHash.digest(); String prfAlg = "SunTls12Prf"; HashAlg hashAlg = cipherSuite.hashAlg; /* * RFC 5246/7.4.9 says that finished messages can * be ciphersuite-specific in both length/PRF hash * algorithm. If we ever run across a different * length, this call will need to be updated. */ @SuppressWarnings("deprecation") TlsPrfParameterSpec spec = new TlsPrfParameterSpec( masterSecretKey, tlsLabel, seed, 12, hashAlg.name, hashAlg.hashLength, hashAlg.blockSize); KeyGenerator kg = JsseJce.getKeyGenerator(prfAlg); kg.init(spec); SecretKey prfKey = kg.generateKey(); if (!"RAW".equals(prfKey.getFormat())) { throw new ProviderException( "Invalid PRF output, format must be RAW. " + "Format received: " + prfKey.getFormat()); } byte[] finished = prfKey.getEncoded(); return finished; } catch (GeneralSecurityException e) { throw new RuntimeException("PRF failed", e); } }