Beispiel #1
0
 private static synchronized boolean isAvailable(BulkCipher cipher) {
   Boolean b = availableCache.get(cipher);
   if (b == null) {
     try {
       SecretKey key = new SecretKeySpec(new byte[cipher.expandedKeySize], cipher.algorithm);
       IvParameterSpec iv = new IvParameterSpec(new byte[cipher.ivSize]);
       cipher.newCipher(ProtocolVersion.DEFAULT, key, iv, null, true);
       b = Boolean.TRUE;
     } catch (NoSuchAlgorithmException e) {
       b = Boolean.FALSE;
     }
     availableCache.put(cipher, b);
   }
   return b.booleanValue();
 }