jdk/src/java.base/share/classes/javax/crypto/Cipher.java
changeset 32649 2ee9017c7597
parent 32647 53b8fd1f3840
child 33241 27eb2d6abda9
equal deleted inserted replaced
32648:1fa861caf840 32649:2ee9017c7597
   334         }
   334         }
   335         return parts;
   335         return parts;
   336     }
   336     }
   337 
   337 
   338     // Provider attribute name for supported chaining mode
   338     // Provider attribute name for supported chaining mode
   339     private final static String ATTR_MODE = "SupportedModes";
   339     private static final String ATTR_MODE = "SupportedModes";
   340     // Provider attribute name for supported padding names
   340     // Provider attribute name for supported padding names
   341     private final static String ATTR_PAD  = "SupportedPaddings";
   341     private static final String ATTR_PAD  = "SupportedPaddings";
   342 
   342 
   343     // constants indicating whether the provider supports
   343     // constants indicating whether the provider supports
   344     // a given mode or padding
   344     // a given mode or padding
   345     private final static int S_NO    = 0;       // does not support
   345     private static final int S_NO    = 0;       // does not support
   346     private final static int S_MAYBE = 1;       // unable to determine
   346     private static final int S_MAYBE = 1;       // unable to determine
   347     private final static int S_YES   = 2;       // does support
   347     private static final int S_YES   = 2;       // does support
   348 
   348 
   349     /**
   349     /**
   350      * Nested class to deal with modes and paddings.
   350      * Nested class to deal with modes and paddings.
   351      */
   351      */
   352     private static class Transform {
   352     private static class Transform {
   408             }
   408             }
   409             return matches(regexp, value) ? S_YES : S_NO;
   409             return matches(regexp, value) ? S_YES : S_NO;
   410         }
   410         }
   411 
   411 
   412         // ConcurrentMap<String,Pattern> for previously compiled patterns
   412         // ConcurrentMap<String,Pattern> for previously compiled patterns
   413         private final static ConcurrentMap<String, Pattern> patternCache =
   413         private static final ConcurrentMap<String, Pattern> patternCache =
   414             new ConcurrentHashMap<String, Pattern>();
   414             new ConcurrentHashMap<String, Pattern>();
   415 
   415 
   416         private static boolean matches(String regexp, String str) {
   416         private static boolean matches(String regexp, String str) {
   417             Pattern pattern = patternCache.get(regexp);
   417             Pattern pattern = patternCache.get(regexp);
   418             if (pattern == null) {
   418             if (pattern == null) {
   785             }
   785             }
   786             throw e;
   786             throw e;
   787         }
   787         }
   788     }
   788     }
   789 
   789 
   790     private final static int I_KEY       = 1;
   790     private static final int I_KEY       = 1;
   791     private final static int I_PARAMSPEC = 2;
   791     private static final int I_PARAMSPEC = 2;
   792     private final static int I_PARAMS    = 3;
   792     private static final int I_PARAMS    = 3;
   793     private final static int I_CERT      = 4;
   793     private static final int I_CERT      = 4;
   794 
   794 
   795     private void implInit(CipherSpi thisSpi, int type, int opmode, Key key,
   795     private void implInit(CipherSpi thisSpi, int type, int opmode, Key key,
   796             AlgorithmParameterSpec paramSpec, AlgorithmParameters params,
   796             AlgorithmParameterSpec paramSpec, AlgorithmParameters params,
   797             SecureRandom random) throws InvalidKeyException,
   797             SecureRandom random) throws InvalidKeyException,
   798             InvalidAlgorithmParameterException {
   798             InvalidAlgorithmParameterException {