Java Code Examples for java.security.Provider.Service#supportsParameter()
The following examples show how to use
java.security.Provider.Service#supportsParameter() .
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: Signature.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int type, Key key, SecureRandom random) throws InvalidKeyException { synchronized (lock) { if (sigSpi != null) { init(sigSpi, type, key, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; if (firstService != null) { s = firstService; firstService = null; } else { s = serviceIterator.next(); } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } // if instance is not a SignatureSpi, ignore it if (isSpi(s) == false) { continue; } try { SignatureSpi spi = newInstance(s); init(spi, type, key, random); provider = s.getProvider(); sigSpi = spi; firstService = null; serviceIterator = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String k = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + k, lastException); } }
Example 2
Source File: SupportsParameter.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private static void checkSupports(Service s, Key key, boolean r) throws Exception { if (s.supportsParameter(key) != r) { throw new Exception("Result mismatch"); } System.out.println("Passed"); }
Example 3
Source File: Cipher.java From Bytecoder with Apache License 2.0 | 4 votes |
private void chooseProvider(int initType, int opmode, Key key, AlgorithmParameterSpec paramSpec, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { synchronized (lock) { if (spi != null) { implInit(spi, initType, opmode, key, paramSpec, params, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; CipherSpi thisSpi; if (firstService != null) { s = firstService; thisSpi = firstSpi; firstService = null; firstSpi = null; } else { s = serviceIterator.next(); thisSpi = null; } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } if (JceSecurity.canUseProvider(s.getProvider()) == false) { continue; } Transform tr = getTransform(s, transforms); if (tr == null) { // should never happen continue; } if (tr.supportsModePadding(s) == S_NO) { continue; } try { if (thisSpi == null) { thisSpi = (CipherSpi)s.newInstance(null); } tr.setModePadding(thisSpi); initCryptoPermission(); implInit(thisSpi, initType, opmode, key, paramSpec, params, random); provider = s.getProvider(); this.spi = thisSpi; firstService = null; serviceIterator = null; transforms = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() // SecurityException from crypto permission check if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof InvalidAlgorithmParameterException) { throw (InvalidAlgorithmParameterException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String kName = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + kName, lastException); } }
Example 4
Source File: SupportsParameter.java From hottub with GNU General Public License v2.0 | 4 votes |
private static void checkSupports(Service s, Key key, boolean r) throws Exception { if (s.supportsParameter(key) != r) { throw new Exception("Result mismatch"); } System.out.println("Passed"); }
Example 5
Source File: Cipher.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int initType, int opmode, Key key, AlgorithmParameterSpec paramSpec, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { synchronized (lock) { if (spi != null) { implInit(spi, initType, opmode, key, paramSpec, params, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; CipherSpi thisSpi; if (firstService != null) { s = firstService; thisSpi = firstSpi; firstService = null; firstSpi = null; } else { s = serviceIterator.next(); thisSpi = null; } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } if (JceSecurity.canUseProvider(s.getProvider()) == false) { continue; } Transform tr = getTransform(s, transforms); if (tr == null) { // should never happen continue; } if (tr.supportsModePadding(s) == S_NO) { continue; } try { if (thisSpi == null) { thisSpi = (CipherSpi)s.newInstance(null); } tr.setModePadding(thisSpi); initCryptoPermission(); implInit(thisSpi, initType, opmode, key, paramSpec, params, random); provider = s.getProvider(); this.spi = thisSpi; firstService = null; serviceIterator = null; transforms = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() // SecurityException from crypto permission check if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof InvalidAlgorithmParameterException) { throw (InvalidAlgorithmParameterException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String kName = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + kName, lastException); } }
Example 6
Source File: Cipher.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int initType, int opmode, Key key, AlgorithmParameterSpec paramSpec, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { synchronized (lock) { if (spi != null) { implInit(spi, initType, opmode, key, paramSpec, params, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; CipherSpi thisSpi; if (firstService != null) { s = firstService; thisSpi = firstSpi; firstService = null; firstSpi = null; } else { s = serviceIterator.next(); thisSpi = null; } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } if (JceSecurity.canUseProvider(s.getProvider()) == false) { continue; } Transform tr = getTransform(s, transforms); if (tr == null) { // should never happen continue; } if (tr.supportsModePadding(s) == S_NO) { continue; } try { if (thisSpi == null) { thisSpi = (CipherSpi)s.newInstance(null); } tr.setModePadding(thisSpi); initCryptoPermission(); implInit(thisSpi, initType, opmode, key, paramSpec, params, random); provider = s.getProvider(); this.spi = thisSpi; firstService = null; serviceIterator = null; transforms = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() // SecurityException from crypto permission check if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof InvalidAlgorithmParameterException) { throw (InvalidAlgorithmParameterException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String kName = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + kName, lastException); } }
Example 7
Source File: Signature.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int type, Key key, SecureRandom random) throws InvalidKeyException { synchronized (lock) { if (sigSpi != null) { init(sigSpi, type, key, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; if (firstService != null) { s = firstService; firstService = null; } else { s = serviceIterator.next(); } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } // if instance is not a SignatureSpi, ignore it if (isSpi(s) == false) { continue; } try { SignatureSpi spi = newInstance(s); init(spi, type, key, random); provider = s.getProvider(); sigSpi = spi; firstService = null; serviceIterator = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String k = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + k, lastException); } }
Example 8
Source File: SupportsParameter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private static void checkSupports(Service s, Key key, boolean r) throws Exception { if (s.supportsParameter(key) != r) { throw new Exception("Result mismatch"); } System.out.println("Passed"); }
Example 9
Source File: Cipher.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int initType, int opmode, Key key, AlgorithmParameterSpec paramSpec, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { synchronized (lock) { if (spi != null) { implInit(spi, initType, opmode, key, paramSpec, params, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; CipherSpi thisSpi; if (firstService != null) { s = firstService; thisSpi = firstSpi; firstService = null; firstSpi = null; } else { s = serviceIterator.next(); thisSpi = null; } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } if (JceSecurity.canUseProvider(s.getProvider()) == false) { continue; } Transform tr = getTransform(s, transforms); if (tr == null) { // should never happen continue; } if (tr.supportsModePadding(s) == S_NO) { continue; } try { if (thisSpi == null) { thisSpi = (CipherSpi)s.newInstance(null); } tr.setModePadding(thisSpi); initCryptoPermission(); implInit(thisSpi, initType, opmode, key, paramSpec, params, random); provider = s.getProvider(); this.spi = thisSpi; firstService = null; serviceIterator = null; transforms = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() // SecurityException from crypto permission check if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof InvalidAlgorithmParameterException) { throw (InvalidAlgorithmParameterException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String kName = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + kName, lastException); } }
Example 10
Source File: SupportsParameter.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private static void checkSupports(Service s, Key key, boolean r) throws Exception { if (s.supportsParameter(key) != r) { throw new Exception("Result mismatch"); } System.out.println("Passed"); }
Example 11
Source File: SupportsParameter.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static void checkSupports(Service s, Key key, boolean r) throws Exception { if (s.supportsParameter(key) != r) { throw new Exception("Result mismatch"); } System.out.println("Passed"); }
Example 12
Source File: SupportsParameter.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static void checkSupports(Service s, Key key, boolean r) throws Exception { if (s.supportsParameter(key) != r) { throw new Exception("Result mismatch"); } System.out.println("Passed"); }
Example 13
Source File: Cipher.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int initType, int opmode, Key key, AlgorithmParameterSpec paramSpec, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { synchronized (lock) { if (spi != null) { implInit(spi, initType, opmode, key, paramSpec, params, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; CipherSpi thisSpi; if (firstService != null) { s = firstService; thisSpi = firstSpi; firstService = null; firstSpi = null; } else { s = serviceIterator.next(); thisSpi = null; } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } if (JceSecurity.canUseProvider(s.getProvider()) == false) { continue; } Transform tr = getTransform(s, transforms); if (tr == null) { // should never happen continue; } if (tr.supportsModePadding(s) == S_NO) { continue; } try { if (thisSpi == null) { thisSpi = (CipherSpi)s.newInstance(null); } tr.setModePadding(thisSpi); initCryptoPermission(); implInit(thisSpi, initType, opmode, key, paramSpec, params, random); provider = s.getProvider(); this.spi = thisSpi; firstService = null; serviceIterator = null; transforms = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() // SecurityException from crypto permission check if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof InvalidAlgorithmParameterException) { throw (InvalidAlgorithmParameterException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String kName = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + kName, lastException); } }
Example 14
Source File: Signature.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int type, Key key, SecureRandom random) throws InvalidKeyException { synchronized (lock) { if (sigSpi != null) { init(sigSpi, type, key, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; if (firstService != null) { s = firstService; firstService = null; } else { s = serviceIterator.next(); } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } // if instance is not a SignatureSpi, ignore it if (isSpi(s) == false) { continue; } try { SignatureSpi spi = newInstance(s); init(spi, type, key, random); provider = s.getProvider(); sigSpi = spi; firstService = null; serviceIterator = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String k = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + k, lastException); } }
Example 15
Source File: SupportsParameter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private static void checkSupports(Service s, Key key, boolean r) throws Exception { if (s.supportsParameter(key) != r) { throw new Exception("Result mismatch"); } System.out.println("Passed"); }
Example 16
Source File: SupportsParameter.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static void checkSupports(Service s, Key key, boolean r) throws Exception { if (s.supportsParameter(key) != r) { throw new Exception("Result mismatch"); } System.out.println("Passed"); }
Example 17
Source File: Signature.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int type, Key key, SecureRandom random) throws InvalidKeyException { synchronized (lock) { if (sigSpi != null) { init(sigSpi, type, key, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; if (firstService != null) { s = firstService; firstService = null; } else { s = serviceIterator.next(); } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } // if instance is not a SignatureSpi, ignore it if (isSpi(s) == false) { continue; } try { SignatureSpi spi = newInstance(s); init(spi, type, key, random); provider = s.getProvider(); sigSpi = spi; firstService = null; serviceIterator = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String k = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + k, lastException); } }
Example 18
Source File: Signature.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int type, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { synchronized (lock) { if (sigSpi != null) { return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; if (firstService != null) { s = firstService; firstService = null; } else { s = serviceIterator.next(); } // if provider says it does not support this key, ignore it if (key != null && s.supportsParameter(key) == false) { continue; } // if instance is not a SignatureSpi, ignore it if (isSpi(s) == false) { continue; } try { SignatureSpi spi = newInstance(s); tryOperation(spi, type, key, params, random); provider = s.getProvider(); sigSpi = spi; firstService = null; serviceIterator = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } if (lastException instanceof InvalidAlgorithmParameterException) { throw (InvalidAlgorithmParameterException)lastException; } String k = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + k, lastException); } }
Example 19
Source File: Cipher.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int initType, int opmode, Key key, AlgorithmParameterSpec paramSpec, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException { synchronized (lock) { if (spi != null) { implInit(spi, initType, opmode, key, paramSpec, params, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; CipherSpi thisSpi; if (firstService != null) { s = firstService; thisSpi = firstSpi; firstService = null; firstSpi = null; } else { s = serviceIterator.next(); thisSpi = null; } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } if (JceSecurity.canUseProvider(s.getProvider()) == false) { continue; } Transform tr = getTransform(s, transforms); if (tr == null) { // should never happen continue; } if (tr.supportsModePadding(s) == S_NO) { continue; } try { if (thisSpi == null) { thisSpi = (CipherSpi)s.newInstance(null); } tr.setModePadding(thisSpi); initCryptoPermission(); implInit(thisSpi, initType, opmode, key, paramSpec, params, random); provider = s.getProvider(); this.spi = thisSpi; firstService = null; serviceIterator = null; transforms = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() // SecurityException from crypto permission check if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof InvalidAlgorithmParameterException) { throw (InvalidAlgorithmParameterException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String kName = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + kName, lastException); } }
Example 20
Source File: Signature.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private void chooseProvider(int type, Key key, SecureRandom random) throws InvalidKeyException { synchronized (lock) { if (sigSpi != null) { init(sigSpi, type, key, random); return; } Exception lastException = null; while ((firstService != null) || serviceIterator.hasNext()) { Service s; if (firstService != null) { s = firstService; firstService = null; } else { s = serviceIterator.next(); } // if provider says it does not support this key, ignore it if (s.supportsParameter(key) == false) { continue; } // if instance is not a SignatureSpi, ignore it if (isSpi(s) == false) { continue; } try { SignatureSpi spi = newInstance(s); init(spi, type, key, random); provider = s.getProvider(); sigSpi = spi; firstService = null; serviceIterator = null; return; } catch (Exception e) { // NoSuchAlgorithmException from newInstance() // InvalidKeyException from init() // RuntimeException (ProviderException) from init() if (lastException == null) { lastException = e; } } } // no working provider found, fail if (lastException instanceof InvalidKeyException) { throw (InvalidKeyException)lastException; } if (lastException instanceof RuntimeException) { throw (RuntimeException)lastException; } String k = (key != null) ? key.getClass().getName() : "(null)"; throw new InvalidKeyException ("No installed provider supports this key: " + k, lastException); } }