src/java.base/share/classes/com/sun/crypto/provider/SunJCE.java
changeset 52995 9af672cab7cb
parent 51407 910f7b56592f
child 52996 2457d862a646
equal deleted inserted replaced
52994:d590cf6b4fac 52995:9af672cab7cb
    26 package com.sun.crypto.provider;
    26 package com.sun.crypto.provider;
    27 
    27 
    28 import java.security.AccessController;
    28 import java.security.AccessController;
    29 import java.security.Provider;
    29 import java.security.Provider;
    30 import java.security.SecureRandom;
    30 import java.security.SecureRandom;
       
    31 import java.security.PrivilegedAction;
       
    32 import java.util.HashMap;
       
    33 import java.util.List;
    31 import static sun.security.util.SecurityConstants.PROVIDER_VER;
    34 import static sun.security.util.SecurityConstants.PROVIDER_VER;
    32 
    35 import static sun.security.provider.SunEntries.createAliases;
       
    36 import static sun.security.provider.SunEntries.createAliasesWithOid;
    33 
    37 
    34 /**
    38 /**
    35  * The "SunJCE" Cryptographic Service Provider.
    39  * The "SunJCE" Cryptographic Service Provider.
    36  *
    40  *
    37  * @author Jan Luehe
    41  * @author Jan Luehe
    78     private static final long serialVersionUID = 6812507587804302833L;
    82     private static final long serialVersionUID = 6812507587804302833L;
    79 
    83 
    80     private static final String info = "SunJCE Provider " +
    84     private static final String info = "SunJCE Provider " +
    81     "(implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, "
    85     "(implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, "
    82     + "Diffie-Hellman, HMAC, ChaCha20)";
    86     + "Diffie-Hellman, HMAC, ChaCha20)";
    83 
       
    84     private static final String OID_PKCS12_RC4_128 = "1.2.840.113549.1.12.1.1";
       
    85     private static final String OID_PKCS12_RC4_40 = "1.2.840.113549.1.12.1.2";
       
    86     private static final String OID_PKCS12_DESede = "1.2.840.113549.1.12.1.3";
       
    87     private static final String OID_PKCS12_RC2_128 = "1.2.840.113549.1.12.1.5";
       
    88     private static final String OID_PKCS12_RC2_40 = "1.2.840.113549.1.12.1.6";
       
    89     private static final String OID_PKCS5_MD5_DES = "1.2.840.113549.1.5.3";
       
    90     private static final String OID_PKCS5_PBKDF2 = "1.2.840.113549.1.5.12";
       
    91     private static final String OID_PKCS5_PBES2 = "1.2.840.113549.1.5.13";
       
    92     private static final String OID_PKCS3 = "1.2.840.113549.1.3.1";
       
    93 
    87 
    94     /* Are we debugging? -- for developers */
    88     /* Are we debugging? -- for developers */
    95     static final boolean debug = false;
    89     static final boolean debug = false;
    96 
    90 
    97     // Instance of this provider, so we don't have to call the provider list
    91     // Instance of this provider, so we don't have to call the provider list
   103     private static class SecureRandomHolder {
    97     private static class SecureRandomHolder {
   104         static final SecureRandom RANDOM = new SecureRandom();
    98         static final SecureRandom RANDOM = new SecureRandom();
   105     }
    99     }
   106     static SecureRandom getRandom() { return SecureRandomHolder.RANDOM; }
   100     static SecureRandom getRandom() { return SecureRandomHolder.RANDOM; }
   107 
   101 
       
   102     private void ps(String type, String algo, String cn,
       
   103             List<String> aliases, HashMap<String, String> attrs) {
       
   104         putService(new Provider.Service(this, type, algo, cn, aliases, attrs));
       
   105     }
       
   106 
   108     public SunJCE() {
   107     public SunJCE() {
   109         /* We are the "SunJCE" provider */
   108         /* We are the "SunJCE" provider */
   110         super("SunJCE", PROVIDER_VER, info);
   109         super("SunJCE", PROVIDER_VER, info);
   111 
   110 
       
   111         // if there is no security manager installed, put directly into
       
   112         // the provider
       
   113         if (System.getSecurityManager() == null) {
       
   114             putEntries();
       
   115         } else {
       
   116             AccessController.doPrivileged(new PrivilegedAction<Void>() {
       
   117                 @Override
       
   118                 public Void run() {
       
   119                     putEntries();
       
   120                     return null;
       
   121                 }
       
   122             });
       
   123         }
       
   124         if (instance == null) {
       
   125             instance = this;
       
   126         }
       
   127     }
       
   128 
       
   129     void putEntries() {
       
   130         // common aliases and oids
       
   131         List<String> aesAliases = createAliases("Rijndael");
       
   132         List<String> desEdeAliases = createAliases("TripleDES");
       
   133         List<String> arcFourAliases = createAliases("RC4");
       
   134         List<String> sunTlsMSAliases = createAliases(
       
   135             "SunTls12MasterSecret", "SunTlsExtendedMasterSecret"
       
   136         );
       
   137         List<String> sunTlsKMAliases = createAliases("SunTls12KeyMaterial");
       
   138         List<String> sunTlsRsaPMSAliases = createAliases("SunTls12RsaPremasterSecret");
       
   139 
       
   140         String aes128Oid = "2.16.840.1.101.3.4.1.";
       
   141         String aes192Oid = "2.16.840.1.101.3.4.1.2";
       
   142         String aes256Oid = "2.16.840.1.101.3.4.1.4";
       
   143 
       
   144         List<String> pkcs12RC4_128Aliases =
       
   145             createAliasesWithOid("1.2.840.113549.1.12.1.1");
       
   146 
       
   147         List<String> pkcs12RC4_40Aliases =
       
   148             createAliasesWithOid("1.2.840.113549.1.12.1.2");
       
   149 
       
   150         List<String> pkcs12DESedeAliases =
       
   151             createAliasesWithOid("1.2.840.113549.1.12.1.3");
       
   152 
       
   153         List<String> pkcs12RC2_128Aliases =
       
   154             createAliasesWithOid("1.2.840.113549.1.12.1.5");
       
   155 
       
   156         List<String> pkcs12RC2_40Aliases =
       
   157             createAliasesWithOid("1.2.840.113549.1.12.1.6");
       
   158 
       
   159         List<String> pkcs5MD5_DESAliases =
       
   160             createAliasesWithOid("1.2.840.113549.1.5.3", "PBE");
       
   161 
       
   162         List<String> pkcs5PBKDF2Aliases =
       
   163             createAliasesWithOid("1.2.840.113549.1.5.12");
       
   164 
       
   165         List<String> pkcs5PBES2Aliases =
       
   166             createAliasesWithOid("1.2.840.113549.1.5.13");
       
   167 
       
   168         List<String> diffieHellmanAliases =
       
   169             createAliasesWithOid("1.2.840.113549.1.3.1", "DH");
       
   170 
       
   171         List<String> chachaPolyAliases =
       
   172             createAliasesWithOid("1.2.840.113549.1.9.16.3.18");
       
   173 
       
   174         String macOidBase = "1.2.840.113549.2.";
       
   175         List<String> macSHA1Aliases = createAliasesWithOid(macOidBase + "7");
       
   176         List<String> macSHA224Aliases = createAliasesWithOid(macOidBase + "8");
       
   177         List<String> macSHA256Aliases = createAliasesWithOid(macOidBase + "9");
       
   178         List<String> macSHA384Aliases = createAliasesWithOid(macOidBase + "10");
       
   179         List<String> macSHA512Aliases = createAliasesWithOid(macOidBase + "11");
       
   180 
       
   181         // reuse attribute map and reset before each reuse
       
   182         HashMap<String, String> attrs = new HashMap<>(3);
       
   183         attrs.put("SupportedModes", "ECB");
       
   184         attrs.put("SupportedPaddings", "NOPADDING|PKCS1PADDING|OAEPPADDING"
       
   185                 + "|OAEPWITHMD5ANDMGF1PADDING"
       
   186                 + "|OAEPWITHSHA1ANDMGF1PADDING"
       
   187                 + "|OAEPWITHSHA-1ANDMGF1PADDING"
       
   188                 + "|OAEPWITHSHA-224ANDMGF1PADDING"
       
   189                 + "|OAEPWITHSHA-256ANDMGF1PADDING"
       
   190                 + "|OAEPWITHSHA-384ANDMGF1PADDING"
       
   191                 + "|OAEPWITHSHA-512ANDMGF1PADDING"
       
   192                 + "|OAEPWITHSHA-512/224ANDMGF1PADDING"
       
   193                 + "|OAEPWITHSHA-512/256ANDMGF1PADDING");
       
   194         attrs.put("SupportedKeyClasses",
       
   195                 "java.security.interfaces.RSAPublicKey" +
       
   196                 "|java.security.interfaces.RSAPrivateKey");
       
   197         ps("Cipher", "RSA",
       
   198                 "com.sun.crypto.provider.RSACipher", null, attrs);
       
   199 
       
   200         // common block cipher modes, pads
   112         final String BLOCK_MODES = "ECB|CBC|PCBC|CTR|CTS|CFB|OFB" +
   201         final String BLOCK_MODES = "ECB|CBC|PCBC|CTR|CTS|CFB|OFB" +
   113             "|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64" +
   202             "|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64" +
   114             "|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64";
   203             "|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64";
   115         final String BLOCK_MODES128 = BLOCK_MODES +
   204         final String BLOCK_MODES128 = BLOCK_MODES +
   116             "|GCM|CFB72|CFB80|CFB88|CFB96|CFB104|CFB112|CFB120|CFB128" +
   205             "|GCM|CFB72|CFB80|CFB88|CFB96|CFB104|CFB112|CFB120|CFB128" +
   117             "|OFB72|OFB80|OFB88|OFB96|OFB104|OFB112|OFB120|OFB128";
   206             "|OFB72|OFB80|OFB88|OFB96|OFB104|OFB112|OFB120|OFB128";
   118         final String BLOCK_PADS = "NOPADDING|PKCS5PADDING|ISO10126PADDING";
   207         final String BLOCK_PADS = "NOPADDING|PKCS5PADDING|ISO10126PADDING";
   119 
   208 
   120         AccessController.doPrivileged(
   209         attrs.clear();
   121             new java.security.PrivilegedAction<Object>() {
   210         attrs.put("SupportedModes", BLOCK_MODES);
   122                 @Override
   211         attrs.put("SupportedPaddings", BLOCK_PADS);
   123                 public Object run() {
   212         attrs.put("SupportedKeyFormats", "RAW");
   124 
   213         ps("Cipher", "DES",
   125                     /*
   214                 "com.sun.crypto.provider.DESCipher", null, attrs);
   126                      * Cipher engines
   215         ps("Cipher", "DESede", "com.sun.crypto.provider.DESedeCipher",
   127                      */
   216                 desEdeAliases, attrs);
   128                     put("Cipher.RSA", "com.sun.crypto.provider.RSACipher");
   217         ps("Cipher", "Blowfish",
   129                     put("Cipher.RSA SupportedModes", "ECB");
   218                 "com.sun.crypto.provider.BlowfishCipher", null, attrs);
   130                     put("Cipher.RSA SupportedPaddings",
   219 
   131                             "NOPADDING|PKCS1PADDING|OAEPPADDING"
   220         ps("Cipher", "RC2",
   132                             + "|OAEPWITHMD5ANDMGF1PADDING"
   221                 "com.sun.crypto.provider.RC2Cipher", null, attrs);
   133                             + "|OAEPWITHSHA1ANDMGF1PADDING"
   222 
   134                             + "|OAEPWITHSHA-1ANDMGF1PADDING"
   223         attrs.clear();
   135                             + "|OAEPWITHSHA-224ANDMGF1PADDING"
   224         attrs.put("SupportedModes", BLOCK_MODES128);
   136                             + "|OAEPWITHSHA-256ANDMGF1PADDING"
   225         attrs.put("SupportedPaddings", BLOCK_PADS);
   137                             + "|OAEPWITHSHA-384ANDMGF1PADDING"
   226         attrs.put("SupportedKeyFormats", "RAW");
   138                             + "|OAEPWITHSHA-512ANDMGF1PADDING"
   227         ps("Cipher", "AES", "com.sun.crypto.provider.AESCipher$General",
   139                             + "|OAEPWITHSHA-512/224ANDMGF1PADDING"
   228                 aesAliases, attrs);
   140                             + "|OAEPWITHSHA-512/256ANDMGF1PADDING");
   229 
   141                     put("Cipher.RSA SupportedKeyClasses",
   230         attrs.clear();
   142                             "java.security.interfaces.RSAPublicKey" +
   231         attrs.put("SupportedKeyFormats", "RAW");
   143                             "|java.security.interfaces.RSAPrivateKey");
   232         ps("Cipher", "AES_128/ECB/NoPadding",
   144 
   233                 "com.sun.crypto.provider.AESCipher$AES128_ECB_NoPadding",
   145                     put("Cipher.DES", "com.sun.crypto.provider.DESCipher");
   234                 createAliasesWithOid(aes128Oid+"1"), attrs);
   146                     put("Cipher.DES SupportedModes", BLOCK_MODES);
   235         ps("Cipher", "AES_128/CBC/NoPadding",
   147                     put("Cipher.DES SupportedPaddings", BLOCK_PADS);
   236                 "com.sun.crypto.provider.AESCipher$AES128_CBC_NoPadding",
   148                     put("Cipher.DES SupportedKeyFormats", "RAW");
   237                 createAliasesWithOid(aes128Oid+"2"), attrs);
   149 
   238         ps("Cipher", "AES_128/OFB/NoPadding",
   150                     put("Cipher.DESede", "com.sun.crypto.provider.DESedeCipher");
   239                 "com.sun.crypto.provider.AESCipher$AES128_OFB_NoPadding",
   151                     put("Alg.Alias.Cipher.TripleDES", "DESede");
   240                 createAliasesWithOid(aes128Oid+"3"), attrs);
   152                     put("Cipher.DESede SupportedModes", BLOCK_MODES);
   241         ps("Cipher", "AES_128/CFB/NoPadding",
   153                     put("Cipher.DESede SupportedPaddings", BLOCK_PADS);
   242                 "com.sun.crypto.provider.AESCipher$AES128_CFB_NoPadding",
   154                     put("Cipher.DESede SupportedKeyFormats", "RAW");
   243                 createAliasesWithOid(aes128Oid+"4"), attrs);
   155 
   244         ps("Cipher", "AES_128/GCM/NoPadding",
   156                     put("Cipher.DESedeWrap",
   245                 "com.sun.crypto.provider.AESCipher$AES128_GCM_NoPadding",
   157                         "com.sun.crypto.provider.DESedeWrapCipher");
   246                 createAliasesWithOid(aes128Oid+"6"), attrs);
   158                     put("Cipher.DESedeWrap SupportedModes", "CBC");
   247 
   159                     put("Cipher.DESedeWrap SupportedPaddings", "NOPADDING");
   248         ps("Cipher", "AES_192/ECB/NoPadding",
   160                     put("Cipher.DESedeWrap SupportedKeyFormats", "RAW");
   249                 "com.sun.crypto.provider.AESCipher$AES192_ECB_NoPadding",
   161 
   250                 createAliasesWithOid(aes192Oid+"1"), attrs);
   162                     // PBES1
   251         ps("Cipher", "AES_192/CBC/NoPadding",
   163 
   252                 "com.sun.crypto.provider.AESCipher$AES192_CBC_NoPadding",
   164                     put("Cipher.PBEWithMD5AndDES",
   253                 createAliasesWithOid(aes192Oid+"2"), attrs);
   165                         "com.sun.crypto.provider.PBEWithMD5AndDESCipher");
   254         ps("Cipher", "AES_192/OFB/NoPadding",
   166                     put("Alg.Alias.Cipher.OID."+OID_PKCS5_MD5_DES,
   255                 "com.sun.crypto.provider.AESCipher$AES192_OFB_NoPadding",
   167                         "PBEWithMD5AndDES");
   256                 createAliasesWithOid(aes192Oid+"3"), attrs);
   168                     put("Alg.Alias.Cipher."+OID_PKCS5_MD5_DES,
   257         ps("Cipher", "AES_192/CFB/NoPadding",
   169                         "PBEWithMD5AndDES");
   258                 "com.sun.crypto.provider.AESCipher$AES192_CFB_NoPadding",
   170 
   259                 createAliasesWithOid(aes192Oid+"4"), attrs);
   171                     put("Cipher.PBEWithMD5AndTripleDES",
   260         ps("Cipher", "AES_192/GCM/NoPadding",
   172                         "com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher");
   261                 "com.sun.crypto.provider.AESCipher$AES192_GCM_NoPadding",
   173 
   262                 createAliasesWithOid(aes192Oid+"6"), attrs);
   174                     put("Cipher.PBEWithSHA1AndDESede",
   263 
   175                         "com.sun.crypto.provider.PKCS12PBECipherCore$" +
   264         ps("Cipher", "AES_256/ECB/NoPadding",
   176                         "PBEWithSHA1AndDESede");
   265                 "com.sun.crypto.provider.AESCipher$AES256_ECB_NoPadding",
   177                     put("Alg.Alias.Cipher.OID." + OID_PKCS12_DESede,
   266                 createAliasesWithOid(aes256Oid+"1"), attrs);
   178                         "PBEWithSHA1AndDESede");
   267         ps("Cipher", "AES_256/CBC/NoPadding",
   179                     put("Alg.Alias.Cipher." + OID_PKCS12_DESede,
   268                 "com.sun.crypto.provider.AESCipher$AES256_CBC_NoPadding",
   180                         "PBEWithSHA1AndDESede");
   269                 createAliasesWithOid(aes256Oid+"2"), attrs);
   181 
   270         ps("Cipher", "AES_256/OFB/NoPadding",
   182                     put("Cipher.PBEWithSHA1AndRC2_40",
   271                 "com.sun.crypto.provider.AESCipher$AES256_OFB_NoPadding",
   183                         "com.sun.crypto.provider.PKCS12PBECipherCore$" +
   272                 createAliasesWithOid(aes256Oid+"3"), attrs);
   184                         "PBEWithSHA1AndRC2_40");
   273         ps("Cipher", "AES_256/CFB/NoPadding",
   185                     put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC2_40,
   274                 "com.sun.crypto.provider.AESCipher$AES256_CFB_NoPadding",
   186                         "PBEWithSHA1AndRC2_40");
   275                 createAliasesWithOid(aes256Oid+"4"), attrs);
   187                     put("Alg.Alias.Cipher." + OID_PKCS12_RC2_40,
   276         ps("Cipher", "AES_256/GCM/NoPadding",
   188                         "PBEWithSHA1AndRC2_40");
   277                 "com.sun.crypto.provider.AESCipher$AES256_GCM_NoPadding",
   189 
   278                 createAliasesWithOid(aes256Oid+"6"), attrs);
   190                     put("Cipher.PBEWithSHA1AndRC2_128",
   279 
   191                         "com.sun.crypto.provider.PKCS12PBECipherCore$" +
   280         attrs.clear();
   192                         "PBEWithSHA1AndRC2_128");
   281         attrs.put("SupportedModes", "CBC");
   193                     put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC2_128,
   282         attrs.put("SupportedPaddings", "NOPADDING");
   194                         "PBEWithSHA1AndRC2_128");
   283         attrs.put("SupportedKeyFormats", "RAW");
   195                     put("Alg.Alias.Cipher." + OID_PKCS12_RC2_128,
   284         ps("Cipher", "DESedeWrap",
   196                         "PBEWithSHA1AndRC2_128");
   285                 "com.sun.crypto.provider.DESedeWrapCipher", null, attrs);
   197 
   286 
   198                     put("Cipher.PBEWithSHA1AndRC4_40",
   287         attrs.clear();
   199                         "com.sun.crypto.provider.PKCS12PBECipherCore$" +
   288         attrs.put("SupportedModes", "ECB");
   200                         "PBEWithSHA1AndRC4_40");
   289         attrs.put("SupportedPaddings", "NOPADDING");
   201                     put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC4_40,
   290         attrs.put("SupportedKeyFormats", "RAW");
   202                         "PBEWithSHA1AndRC4_40");
   291         ps("Cipher", "ARCFOUR", "com.sun.crypto.provider.ARCFOURCipher",
   203                     put("Alg.Alias.Cipher." + OID_PKCS12_RC4_40,
   292                 arcFourAliases, attrs);
   204                         "PBEWithSHA1AndRC4_40");
   293         ps("Cipher", "AESWrap", "com.sun.crypto.provider.AESWrapCipher$General",
   205 
   294                 null, attrs);
   206                     put("Cipher.PBEWithSHA1AndRC4_128",
   295         ps("Cipher", "AESWrap_128",
   207                         "com.sun.crypto.provider.PKCS12PBECipherCore$" +
   296                 "com.sun.crypto.provider.AESWrapCipher$AES128",
   208                         "PBEWithSHA1AndRC4_128");
   297                 createAliasesWithOid(aes128Oid+"5"), attrs);
   209                     put("Alg.Alias.Cipher.OID." + OID_PKCS12_RC4_128,
   298         ps("Cipher", "AESWrap_192",
   210                         "PBEWithSHA1AndRC4_128");
   299                 "com.sun.crypto.provider.AESWrapCipher$AES192",
   211                     put("Alg.Alias.Cipher." + OID_PKCS12_RC4_128,
   300                 createAliasesWithOid(aes192Oid+"5"), attrs);
   212                         "PBEWithSHA1AndRC4_128");
   301         ps("Cipher", "AESWrap_256",
   213 
   302                 "com.sun.crypto.provider.AESWrapCipher$AES256",
   214                     //PBES2
   303                 createAliasesWithOid(aes256Oid+"5"), attrs);
   215 
   304 
   216                     put("Cipher.PBEWithHmacSHA1AndAES_128",
   305         attrs.clear();
   217                         "com.sun.crypto.provider.PBES2Core$HmacSHA1AndAES_128");
   306         attrs.put("SupportedKeyFormats", "RAW");
   218 
   307         ps("Cipher",  "ChaCha20",
   219                     put("Cipher.PBEWithHmacSHA224AndAES_128",
   308                 "com.sun.crypto.provider.ChaCha20Cipher$ChaCha20Only",
   220                         "com.sun.crypto.provider.PBES2Core$" +
   309                 null, attrs);
   221                             "HmacSHA224AndAES_128");
   310         ps("Cipher",  "ChaCha20-Poly1305",
   222 
   311                 "com.sun.crypto.provider.ChaCha20Cipher$ChaCha20Poly1305",
   223                     put("Cipher.PBEWithHmacSHA256AndAES_128",
   312                 chachaPolyAliases, attrs);
   224                         "com.sun.crypto.provider.PBES2Core$" +
   313 
   225                             "HmacSHA256AndAES_128");
   314         // PBES1
   226 
   315         ps("Cipher", "PBEWithMD5AndDES",
   227                     put("Cipher.PBEWithHmacSHA384AndAES_128",
   316                 "com.sun.crypto.provider.PBEWithMD5AndDESCipher",
   228                         "com.sun.crypto.provider.PBES2Core$" +
   317                 pkcs5MD5_DESAliases, null);
   229                             "HmacSHA384AndAES_128");
   318         ps("Cipher", "PBEWithMD5AndTripleDES",
   230 
   319                 "com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher",
   231                     put("Cipher.PBEWithHmacSHA512AndAES_128",
   320                 null, null);
   232                         "com.sun.crypto.provider.PBES2Core$" +
   321         ps("Cipher", "PBEWithSHA1AndDESede",
   233                             "HmacSHA512AndAES_128");
   322                 "com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndDESede",
   234 
   323                 pkcs12DESedeAliases, null);
   235                     put("Cipher.PBEWithHmacSHA1AndAES_256",
   324         ps("Cipher", "PBEWithSHA1AndRC2_40",
   236                         "com.sun.crypto.provider.PBES2Core$HmacSHA1AndAES_256");
   325                 "com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC2_40",
   237 
   326                 pkcs12RC2_40Aliases, null);
   238                     put("Cipher.PBEWithHmacSHA224AndAES_256",
   327         ps("Cipher", "PBEWithSHA1AndRC2_128",
   239                         "com.sun.crypto.provider.PBES2Core$" +
   328                 "com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC2_128",
   240                             "HmacSHA224AndAES_256");
   329                 pkcs12RC2_128Aliases, null);
   241 
   330         ps("Cipher", "PBEWithSHA1AndRC4_40",
   242                     put("Cipher.PBEWithHmacSHA256AndAES_256",
   331                 "com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC4_40",
   243                         "com.sun.crypto.provider.PBES2Core$" +
   332                 pkcs12RC4_40Aliases, null);
   244                             "HmacSHA256AndAES_256");
   333 
   245 
   334         ps("Cipher", "PBEWithSHA1AndRC4_128",
   246                     put("Cipher.PBEWithHmacSHA384AndAES_256",
   335                 "com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC4_128",
   247                         "com.sun.crypto.provider.PBES2Core$" +
   336                 pkcs12RC4_128Aliases, null);
   248                             "HmacSHA384AndAES_256");
   337 
   249 
   338         // PBES2
   250                     put("Cipher.PBEWithHmacSHA512AndAES_256",
   339         ps("Cipher", "PBEWithHmacSHA1AndAES_128",
   251                         "com.sun.crypto.provider.PBES2Core$" +
   340                 "com.sun.crypto.provider.PBES2Core$HmacSHA1AndAES_128",
   252                             "HmacSHA512AndAES_256");
   341                 null, null);
   253 
   342 
   254                     put("Cipher.Blowfish",
   343         ps("Cipher", "PBEWithHmacSHA224AndAES_128",
   255                         "com.sun.crypto.provider.BlowfishCipher");
   344                 "com.sun.crypto.provider.PBES2Core$HmacSHA224AndAES_128",
   256                     put("Cipher.Blowfish SupportedModes", BLOCK_MODES);
   345                 null, null);
   257                     put("Cipher.Blowfish SupportedPaddings", BLOCK_PADS);
   346 
   258                     put("Cipher.Blowfish SupportedKeyFormats", "RAW");
   347         ps("Cipher", "PBEWithHmacSHA256AndAES_128",
   259 
   348                 "com.sun.crypto.provider.PBES2Core$HmacSHA256AndAES_128",
   260                     put("Cipher.AES", "com.sun.crypto.provider.AESCipher$General");
   349                 null, null);
   261                     put("Alg.Alias.Cipher.Rijndael", "AES");
   350 
   262                     put("Cipher.AES SupportedModes", BLOCK_MODES128);
   351         ps("Cipher", "PBEWithHmacSHA384AndAES_128",
   263                     put("Cipher.AES SupportedPaddings", BLOCK_PADS);
   352                 "com.sun.crypto.provider.PBES2Core$HmacSHA384AndAES_128",
   264                     put("Cipher.AES SupportedKeyFormats", "RAW");
   353                 null, null);
   265 
   354 
   266                     put("Cipher.AES_128/ECB/NoPadding", "com.sun.crypto.provider.AESCipher$AES128_ECB_NoPadding");
   355         ps("Cipher", "PBEWithHmacSHA512AndAES_128",
   267                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.1", "AES_128/ECB/NoPadding");
   356                 "com.sun.crypto.provider.PBES2Core$HmacSHA512AndAES_128",
   268                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.1", "AES_128/ECB/NoPadding");
   357                 null, null);
   269                     put("Cipher.AES_128/CBC/NoPadding", "com.sun.crypto.provider.AESCipher$AES128_CBC_NoPadding");
   358 
   270                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.2", "AES_128/CBC/NoPadding");
   359         ps("Cipher", "PBEWithHmacSHA1AndAES_256",
   271                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.2", "AES_128/CBC/NoPadding");
   360                 "com.sun.crypto.provider.PBES2Core$HmacSHA1AndAES_256",
   272                     put("Cipher.AES_128/OFB/NoPadding", "com.sun.crypto.provider.AESCipher$AES128_OFB_NoPadding");
   361                 null, null);
   273                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.3", "AES_128/OFB/NoPadding");
   362 
   274                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.3", "AES_128/OFB/NoPadding");
   363         ps("Cipher", "PBEWithHmacSHA224AndAES_256",
   275                     put("Cipher.AES_128/CFB/NoPadding", "com.sun.crypto.provider.AESCipher$AES128_CFB_NoPadding");
   364                 "com.sun.crypto.provider.PBES2Core$HmacSHA224AndAES_256",
   276                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.4", "AES_128/CFB/NoPadding");
   365                 null, null);
   277                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.4", "AES_128/CFB/NoPadding");
   366 
   278                     put("Cipher.AES_128/GCM/NoPadding", "com.sun.crypto.provider.AESCipher$AES128_GCM_NoPadding");
   367         ps("Cipher", "PBEWithHmacSHA256AndAES_256",
   279                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.6", "AES_128/GCM/NoPadding");
   368                 "com.sun.crypto.provider.PBES2Core$HmacSHA256AndAES_256",
   280                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.6", "AES_128/GCM/NoPadding");
   369                 null, null);
   281 
   370 
   282                     put("Cipher.AES_192/ECB/NoPadding", "com.sun.crypto.provider.AESCipher$AES192_ECB_NoPadding");
   371         ps("Cipher", "PBEWithHmacSHA384AndAES_256",
   283                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.21", "AES_192/ECB/NoPadding");
   372                 "com.sun.crypto.provider.PBES2Core$HmacSHA384AndAES_256",
   284                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.21", "AES_192/ECB/NoPadding");
   373                 null, null);
   285                     put("Cipher.AES_192/CBC/NoPadding", "com.sun.crypto.provider.AESCipher$AES192_CBC_NoPadding");
   374 
   286                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.22", "AES_192/CBC/NoPadding");
   375         ps("Cipher", "PBEWithHmacSHA512AndAES_256",
   287                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.22", "AES_192/CBC/NoPadding");
   376                 "com.sun.crypto.provider.PBES2Core$HmacSHA512AndAES_256",
   288                     put("Cipher.AES_192/OFB/NoPadding", "com.sun.crypto.provider.AESCipher$AES192_OFB_NoPadding");
   377                 null, null);
   289                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.23", "AES_192/OFB/NoPadding");
   378 
   290                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.23", "AES_192/OFB/NoPadding");
   379         /*
   291                     put("Cipher.AES_192/CFB/NoPadding", "com.sun.crypto.provider.AESCipher$AES192_CFB_NoPadding");
   380          * Key(pair) Generator engines
   292                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.24", "AES_192/CFB/NoPadding");
   381          */
   293                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.24", "AES_192/CFB/NoPadding");
   382         ps("KeyGenerator", "DES",
   294                     put("Cipher.AES_192/GCM/NoPadding", "com.sun.crypto.provider.AESCipher$AES192_GCM_NoPadding");
   383                 "com.sun.crypto.provider.DESKeyGenerator",
   295                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.26", "AES_192/GCM/NoPadding");
   384                 null, null);
   296                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.26", "AES_192/GCM/NoPadding");
   385         ps("KeyGenerator", "DESede",
   297 
   386                 "com.sun.crypto.provider.DESedeKeyGenerator",
   298                     put("Cipher.AES_256/ECB/NoPadding", "com.sun.crypto.provider.AESCipher$AES256_ECB_NoPadding");
   387                 desEdeAliases, null);
   299                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.41", "AES_256/ECB/NoPadding");
   388         ps("KeyGenerator", "Blowfish",
   300                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.41", "AES_256/ECB/NoPadding");
   389                 "com.sun.crypto.provider.BlowfishKeyGenerator",
   301                     put("Cipher.AES_256/CBC/NoPadding", "com.sun.crypto.provider.AESCipher$AES256_CBC_NoPadding");
   390                 null, null);
   302                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.42", "AES_256/CBC/NoPadding");
   391         ps("KeyGenerator", "AES",
   303                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.42", "AES_256/CBC/NoPadding");
   392                 "com.sun.crypto.provider.AESKeyGenerator",
   304                     put("Cipher.AES_256/OFB/NoPadding", "com.sun.crypto.provider.AESCipher$AES256_OFB_NoPadding");
   393                 aesAliases, null);
   305                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.43", "AES_256/OFB/NoPadding");
   394         ps("KeyGenerator", "RC2",
   306                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.43", "AES_256/OFB/NoPadding");
   395                 "com.sun.crypto.provider.KeyGeneratorCore$RC2KeyGenerator",
   307                     put("Cipher.AES_256/CFB/NoPadding", "com.sun.crypto.provider.AESCipher$AES256_CFB_NoPadding");
   396                 null, null);
   308                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.44", "AES_256/CFB/NoPadding");
   397         ps("KeyGenerator", "ARCFOUR",
   309                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.44", "AES_256/CFB/NoPadding");
   398                 "com.sun.crypto.provider.KeyGeneratorCore$ARCFOURKeyGenerator",
   310                     put("Cipher.AES_256/GCM/NoPadding", "com.sun.crypto.provider.AESCipher$AES256_GCM_NoPadding");
   399                 arcFourAliases, null);
   311                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.46", "AES_256/GCM/NoPadding");
   400         ps("KeyGenerator", "ChaCha20",
   312                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.46", "AES_256/GCM/NoPadding");
   401                 "com.sun.crypto.provider.KeyGeneratorCore$ChaCha20KeyGenerator",
   313 
   402                 null, null);
   314                     put("Cipher.AESWrap", "com.sun.crypto.provider.AESWrapCipher$General");
   403         ps("KeyGenerator", "HmacMD5",
   315                     put("Cipher.AESWrap SupportedModes", "ECB");
   404                 "com.sun.crypto.provider.HmacMD5KeyGenerator",
   316                     put("Cipher.AESWrap SupportedPaddings", "NOPADDING");
   405                 null, null);
   317                     put("Cipher.AESWrap SupportedKeyFormats", "RAW");
   406 
   318 
   407         ps("KeyGenerator", "HmacSHA1",
   319                     put("Cipher.AESWrap_128", "com.sun.crypto.provider.AESWrapCipher$AES128");
   408                 "com.sun.crypto.provider.HmacSHA1KeyGenerator",
   320                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.5", "AESWrap_128");
   409                 macSHA1Aliases, null);
   321                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.5", "AESWrap_128");
   410         ps("KeyGenerator", "HmacSHA224",
   322                     put("Cipher.AESWrap_192", "com.sun.crypto.provider.AESWrapCipher$AES192");
   411                 "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA224",
   323                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.25", "AESWrap_192");
   412                 macSHA224Aliases, null);
   324                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.25", "AESWrap_192");
   413         ps("KeyGenerator", "HmacSHA256",
   325                     put("Cipher.AESWrap_256", "com.sun.crypto.provider.AESWrapCipher$AES256");
   414                 "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA256",
   326                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.45", "AESWrap_256");
   415                 macSHA256Aliases, null);
   327                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.45", "AESWrap_256");
   416         ps("KeyGenerator", "HmacSHA384",
   328 
   417                 "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA384",
   329                     put("Cipher.RC2",
   418                 macSHA384Aliases, null);
   330                         "com.sun.crypto.provider.RC2Cipher");
   419         ps("KeyGenerator", "HmacSHA512",
   331                     put("Cipher.RC2 SupportedModes", BLOCK_MODES);
   420                 "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA512",
   332                     put("Cipher.RC2 SupportedPaddings", BLOCK_PADS);
   421                 macSHA512Aliases, null);
   333                     put("Cipher.RC2 SupportedKeyFormats", "RAW");
   422 
   334 
   423         ps("KeyPairGenerator", "DiffieHellman",
   335                     put("Cipher.ARCFOUR",
   424                 "com.sun.crypto.provider.DHKeyPairGenerator",
   336                         "com.sun.crypto.provider.ARCFOURCipher");
   425                 diffieHellmanAliases, null);
   337                     put("Alg.Alias.Cipher.RC4", "ARCFOUR");
   426 
   338                     put("Cipher.ARCFOUR SupportedModes", "ECB");
   427         /*
   339                     put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
   428          * Algorithm parameter generation engines
   340                     put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
   429          */
   341 
   430         ps("AlgorithmParameterGenerator",
   342                     put("Cipher.ChaCha20",
   431                 "DiffieHellman", "com.sun.crypto.provider.DHParameterGenerator",
   343                         "com.sun.crypto.provider.ChaCha20Cipher$ChaCha20Only");
   432                 diffieHellmanAliases, null);
   344                     put("Cipher.ChaCha20 SupportedKeyFormats", "RAW");
   433 
   345                     put("Cipher.ChaCha20-Poly1305",
   434         /*
   346                         "com.sun.crypto.provider.ChaCha20Cipher$ChaCha20Poly1305");
   435          * Key Agreement engines
   347                     put("Cipher.ChaCha20-Poly1305 SupportedKeyFormats", "RAW");
   436          */
   348                     put("Alg.Alias.Cipher.1.2.840.113549.1.9.16.3.18", "ChaCha20-Poly1305");
   437         attrs.clear();
   349                     put("Alg.Alias.Cipher.OID.1.2.840.113549.1.9.16.3.18", "ChaCha20-Poly1305");
   438         attrs.put("SupportedKeyClasses", "javax.crypto.interfaces.DHPublicKey" +
   350 
       
   351                     /*
       
   352                      * Key(pair) Generator engines
       
   353                      */
       
   354                     put("KeyGenerator.DES",
       
   355                         "com.sun.crypto.provider.DESKeyGenerator");
       
   356 
       
   357                     put("KeyGenerator.DESede",
       
   358                         "com.sun.crypto.provider.DESedeKeyGenerator");
       
   359                     put("Alg.Alias.KeyGenerator.TripleDES", "DESede");
       
   360 
       
   361                     put("KeyGenerator.Blowfish",
       
   362                         "com.sun.crypto.provider.BlowfishKeyGenerator");
       
   363 
       
   364                     put("KeyGenerator.AES",
       
   365                         "com.sun.crypto.provider.AESKeyGenerator");
       
   366                     put("Alg.Alias.KeyGenerator.Rijndael", "AES");
       
   367 
       
   368                     put("KeyGenerator.RC2",
       
   369                         "com.sun.crypto.provider.KeyGeneratorCore$" +
       
   370                         "RC2KeyGenerator");
       
   371                     put("KeyGenerator.ARCFOUR",
       
   372                         "com.sun.crypto.provider.KeyGeneratorCore$" +
       
   373                         "ARCFOURKeyGenerator");
       
   374                     put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
       
   375 
       
   376                     put("KeyGenerator.ChaCha20",
       
   377                         "com.sun.crypto.provider.KeyGeneratorCore$" +
       
   378                         "ChaCha20KeyGenerator");
       
   379 
       
   380                     put("KeyGenerator.HmacMD5",
       
   381                         "com.sun.crypto.provider.HmacMD5KeyGenerator");
       
   382 
       
   383                     put("KeyGenerator.HmacSHA1",
       
   384                         "com.sun.crypto.provider.HmacSHA1KeyGenerator");
       
   385                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.7", "HmacSHA1");
       
   386                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.7", "HmacSHA1");
       
   387 
       
   388                     put("KeyGenerator.HmacSHA224",
       
   389                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA224");
       
   390                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.8", "HmacSHA224");
       
   391                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.8", "HmacSHA224");
       
   392 
       
   393                     put("KeyGenerator.HmacSHA256",
       
   394                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA256");
       
   395                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.9", "HmacSHA256");
       
   396                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.9", "HmacSHA256");
       
   397 
       
   398                     put("KeyGenerator.HmacSHA384",
       
   399                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA384");
       
   400                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.10", "HmacSHA384");
       
   401                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.10", "HmacSHA384");
       
   402 
       
   403                     put("KeyGenerator.HmacSHA512",
       
   404                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA512");
       
   405                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.11", "HmacSHA512");
       
   406                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.11", "HmacSHA512");
       
   407 
       
   408                     put("KeyPairGenerator.DiffieHellman",
       
   409                         "com.sun.crypto.provider.DHKeyPairGenerator");
       
   410                     put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
       
   411                     put("Alg.Alias.KeyPairGenerator.OID."+OID_PKCS3,
       
   412                         "DiffieHellman");
       
   413                     put("Alg.Alias.KeyPairGenerator."+OID_PKCS3,
       
   414                         "DiffieHellman");
       
   415 
       
   416                     /*
       
   417                      * Algorithm parameter generation engines
       
   418                      */
       
   419                     put("AlgorithmParameterGenerator.DiffieHellman",
       
   420                         "com.sun.crypto.provider.DHParameterGenerator");
       
   421                     put("Alg.Alias.AlgorithmParameterGenerator.DH",
       
   422                         "DiffieHellman");
       
   423                     put("Alg.Alias.AlgorithmParameterGenerator.OID."+OID_PKCS3,
       
   424                         "DiffieHellman");
       
   425                     put("Alg.Alias.AlgorithmParameterGenerator."+OID_PKCS3,
       
   426                         "DiffieHellman");
       
   427 
       
   428                     /*
       
   429                      * Key Agreement engines
       
   430                      */
       
   431                     put("KeyAgreement.DiffieHellman",
       
   432                         "com.sun.crypto.provider.DHKeyAgreement");
       
   433                     put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
       
   434                     put("Alg.Alias.KeyAgreement.OID."+OID_PKCS3, "DiffieHellman");
       
   435                     put("Alg.Alias.KeyAgreement."+OID_PKCS3, "DiffieHellman");
       
   436 
       
   437                     put("KeyAgreement.DiffieHellman SupportedKeyClasses",
       
   438                         "javax.crypto.interfaces.DHPublicKey" +
       
   439                         "|javax.crypto.interfaces.DHPrivateKey");
   439                         "|javax.crypto.interfaces.DHPrivateKey");
   440 
   440         ps("KeyAgreement", "DiffieHellman",
   441                     /*
   441                 "com.sun.crypto.provider.DHKeyAgreement",
   442                      * Algorithm Parameter engines
   442                 diffieHellmanAliases, attrs);
   443                      */
   443 
   444                     put("AlgorithmParameters.DiffieHellman",
   444         /*
   445                         "com.sun.crypto.provider.DHParameters");
   445          * Algorithm Parameter engines
   446                     put("Alg.Alias.AlgorithmParameters.DH", "DiffieHellman");
   446          */
   447                     put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS3,
   447         ps("AlgorithmParameters", "DiffieHellman",
   448                         "DiffieHellman");
   448                 "com.sun.crypto.provider.DHParameters",
   449                     put("Alg.Alias.AlgorithmParameters."+OID_PKCS3,
   449                 diffieHellmanAliases, null);
   450                         "DiffieHellman");
   450 
   451 
   451         ps("AlgorithmParameters", "DES",
   452                     put("AlgorithmParameters.DES",
   452                 "com.sun.crypto.provider.DESParameters",
   453                         "com.sun.crypto.provider.DESParameters");
   453                 null, null);
   454 
   454 
   455                     put("AlgorithmParameters.DESede",
   455         ps("AlgorithmParameters", "DESede",
   456                         "com.sun.crypto.provider.DESedeParameters");
   456                 "com.sun.crypto.provider.DESedeParameters",
   457                     put("Alg.Alias.AlgorithmParameters.TripleDES", "DESede");
   457                 desEdeAliases, null);
   458 
   458 
   459                     put("AlgorithmParameters.PBE",
   459         ps("AlgorithmParameters", "PBEWithMD5AndDES",
   460                         "com.sun.crypto.provider.PBEParameters");
   460                 "com.sun.crypto.provider.PBEParameters",
   461 
   461                 pkcs5MD5_DESAliases, null);
   462                     put("AlgorithmParameters.PBEWithMD5AndDES",
   462 
   463                         "com.sun.crypto.provider.PBEParameters");
   463         ps("AlgorithmParameters", "PBEWithMD5AndTripleDES",
   464                     put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS5_MD5_DES,
   464                 "com.sun.crypto.provider.PBEParameters",
   465                         "PBEWithMD5AndDES");
   465                 null, null);
   466                     put("Alg.Alias.AlgorithmParameters."+OID_PKCS5_MD5_DES,
   466 
   467                         "PBEWithMD5AndDES");
   467         ps("AlgorithmParameters", "PBEWithSHA1AndDESede",
   468 
   468                 "com.sun.crypto.provider.PBEParameters",
   469                     put("AlgorithmParameters.PBEWithMD5AndTripleDES",
   469                 pkcs12DESedeAliases, null);
   470                         "com.sun.crypto.provider.PBEParameters");
   470 
   471 
   471         ps("AlgorithmParameters", "PBEWithSHA1AndRC2_40",
   472                     put("AlgorithmParameters.PBEWithSHA1AndDESede",
   472                 "com.sun.crypto.provider.PBEParameters",
   473                         "com.sun.crypto.provider.PBEParameters");
   473                 pkcs12RC2_40Aliases, null);
   474                     put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_DESede,
   474 
   475                         "PBEWithSHA1AndDESede");
   475         ps("AlgorithmParameters", "PBEWithSHA1AndRC2_128",
   476                     put("Alg.Alias.AlgorithmParameters."+OID_PKCS12_DESede,
   476                 "com.sun.crypto.provider.PBEParameters",
   477                         "PBEWithSHA1AndDESede");
   477                 pkcs12RC2_128Aliases, null);
   478 
   478 
   479                     put("AlgorithmParameters.PBEWithSHA1AndRC2_40",
   479         ps("AlgorithmParameters", "PBEWithSHA1AndRC4_40",
   480                         "com.sun.crypto.provider.PBEParameters");
   480                 "com.sun.crypto.provider.PBEParameters",
   481                     put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC2_40,
   481                 pkcs12RC4_40Aliases, null);
   482                         "PBEWithSHA1AndRC2_40");
   482 
   483                     put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC2_40,
   483         ps("AlgorithmParameters", "PBEWithSHA1AndRC4_128",
   484                         "PBEWithSHA1AndRC2_40");
   484                 "com.sun.crypto.provider.PBEParameters",
   485 
   485                 pkcs12RC4_128Aliases, null);
   486                     put("AlgorithmParameters.PBEWithSHA1AndRC2_128",
   486 
   487                         "com.sun.crypto.provider.PBEParameters");
   487         ps("AlgorithmParameters", "PBES2",
   488                     put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC2_128,
   488                 "com.sun.crypto.provider.PBES2Parameters$General",
   489                         "PBEWithSHA1AndRC2_128");
   489                 pkcs5PBES2Aliases, null);
   490                     put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC2_128,
   490 
   491                         "PBEWithSHA1AndRC2_128");
   491         ps("AlgorithmParameters", "PBEWithHmacSHA1AndAES_128",
   492 
   492                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA1AndAES_128",
   493                     put("AlgorithmParameters.PBEWithSHA1AndRC4_40",
   493                 null, null);
   494                         "com.sun.crypto.provider.PBEParameters");
   494 
   495                     put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC4_40,
   495         ps("AlgorithmParameters", "PBEWithHmacSHA224AndAES_128",
   496                         "PBEWithSHA1AndRC4_40");
   496                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA224AndAES_128",
   497                     put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC4_40,
   497                 null, null);
   498                         "PBEWithSHA1AndRC4_40");
   498 
   499 
   499         ps("AlgorithmParameters", "PBEWithHmacSHA256AndAES_128",
   500                     put("AlgorithmParameters.PBEWithSHA1AndRC4_128",
   500                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA256AndAES_128",
   501                         "com.sun.crypto.provider.PBEParameters");
   501                 null, null);
   502                     put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS12_RC4_128,
   502 
   503                         "PBEWithSHA1AndRC4_128");
   503         ps("AlgorithmParameters", "PBEWithHmacSHA384AndAES_128",
   504                     put("Alg.Alias.AlgorithmParameters." + OID_PKCS12_RC4_128,
   504                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA384AndAES_128",
   505                         "PBEWithSHA1AndRC4_128");
   505                 null, null);
   506 
   506 
   507                     put("AlgorithmParameters.PBES2",
   507         ps("AlgorithmParameters", "PBEWithHmacSHA512AndAES_128",
   508                         "com.sun.crypto.provider.PBES2Parameters$General");
   508                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA512AndAES_128",
   509                     put("Alg.Alias.AlgorithmParameters.OID."+OID_PKCS5_PBES2,
   509                 null, null);
   510                         "PBES2");
   510 
   511                     put("Alg.Alias.AlgorithmParameters." + OID_PKCS5_PBES2,
   511         ps("AlgorithmParameters", "PBEWithHmacSHA1AndAES_256",
   512                         "PBES2");
   512                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA1AndAES_256",
   513 
   513                 null, null);
   514                     put("AlgorithmParameters.PBEWithHmacSHA1AndAES_128",
   514 
   515                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA1AndAES_128");
   515         ps("AlgorithmParameters", "PBEWithHmacSHA224AndAES_256",
   516 
   516                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA224AndAES_256",
   517                     put("AlgorithmParameters.PBEWithHmacSHA224AndAES_128",
   517                 null, null);
   518                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA224AndAES_128");
   518 
   519 
   519         ps("AlgorithmParameters", "PBEWithHmacSHA256AndAES_256",
   520                     put("AlgorithmParameters.PBEWithHmacSHA256AndAES_128",
   520                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA256AndAES_256",
   521                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA256AndAES_128");
   521                 null, null);
   522 
   522 
   523                     put("AlgorithmParameters.PBEWithHmacSHA384AndAES_128",
   523         ps("AlgorithmParameters", "PBEWithHmacSHA384AndAES_256",
   524                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA384AndAES_128");
   524                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA384AndAES_256",
   525 
   525                 null, null);
   526                     put("AlgorithmParameters.PBEWithHmacSHA512AndAES_128",
   526 
   527                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA512AndAES_128");
   527         ps("AlgorithmParameters", "PBEWithHmacSHA512AndAES_256",
   528 
   528                 "com.sun.crypto.provider.PBES2Parameters$HmacSHA512AndAES_256",
   529                     put("AlgorithmParameters.PBEWithHmacSHA1AndAES_256",
   529                 null, null);
   530                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA1AndAES_256");
   530 
   531 
   531         ps("AlgorithmParameters", "Blowfish",
   532                     put("AlgorithmParameters.PBEWithHmacSHA224AndAES_256",
   532                 "com.sun.crypto.provider.BlowfishParameters",
   533                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA224AndAES_256");
   533                 null, null);
   534 
   534 
   535                     put("AlgorithmParameters.PBEWithHmacSHA256AndAES_256",
   535         ps("AlgorithmParameters", "AES",
   536                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA256AndAES_256");
   536                 "com.sun.crypto.provider.AESParameters",
   537 
   537                 aesAliases, null);
   538                     put("AlgorithmParameters.PBEWithHmacSHA384AndAES_256",
   538 
   539                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA384AndAES_256");
   539         ps("AlgorithmParameters", "GCM",
   540 
   540                 "com.sun.crypto.provider.GCMParameters",
   541                     put("AlgorithmParameters.PBEWithHmacSHA512AndAES_256",
   541                 null, null);
   542                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA512AndAES_256");
   542 
   543 
   543         ps("AlgorithmParameters", "RC2",
   544                     put("AlgorithmParameters.Blowfish",
   544                 "com.sun.crypto.provider.RC2Parameters",
   545                         "com.sun.crypto.provider.BlowfishParameters");
   545                 null, null);
   546 
   546 
   547                     put("AlgorithmParameters.AES",
   547         ps("AlgorithmParameters", "OAEP",
   548                         "com.sun.crypto.provider.AESParameters");
   548                 "com.sun.crypto.provider.OAEPParameters",
   549                     put("Alg.Alias.AlgorithmParameters.Rijndael", "AES");
   549                 null, null);
   550                     put("AlgorithmParameters.GCM",
   550 
   551                         "com.sun.crypto.provider.GCMParameters");
   551         ps("AlgorithmParameters", "ChaCha20-Poly1305",
   552 
   552                 "com.sun.crypto.provider.ChaCha20Poly1305Parameters",
   553 
   553                 chachaPolyAliases, null);
   554                     put("AlgorithmParameters.RC2",
   554 
   555                         "com.sun.crypto.provider.RC2Parameters");
   555         /*
   556 
   556          * Key factories
   557                     put("AlgorithmParameters.OAEP",
   557          */
   558                         "com.sun.crypto.provider.OAEPParameters");
   558         ps("KeyFactory", "DiffieHellman",
   559 
   559                 "com.sun.crypto.provider.DHKeyFactory",
   560                     put("AlgorithmParameters.ChaCha20-Poly1305",
   560                 diffieHellmanAliases, null);
   561                         "com.sun.crypto.provider.ChaCha20Poly1305Parameters");
   561 
   562 
   562         /*
   563                     /*
   563          * Secret-key factories
   564                      * Key factories
   564          */
   565                      */
   565         ps("SecretKeyFactory", "DES",
   566                     put("KeyFactory.DiffieHellman",
   566                 "com.sun.crypto.provider.DESKeyFactory",
   567                         "com.sun.crypto.provider.DHKeyFactory");
   567                 null, null);
   568                     put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
   568 
   569                     put("Alg.Alias.KeyFactory.OID."+OID_PKCS3,
   569         ps("SecretKeyFactory", "DESede",
   570                         "DiffieHellman");
   570                 "com.sun.crypto.provider.DESedeKeyFactory",
   571                     put("Alg.Alias.KeyFactory."+OID_PKCS3, "DiffieHellman");
   571                 desEdeAliases, null);
   572 
   572 
   573                     /*
   573         ps("SecretKeyFactory", "PBEWithMD5AndDES",
   574                      * Secret-key factories
   574                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES",
   575                      */
   575                 pkcs5MD5_DESAliases, null);
   576                     put("SecretKeyFactory.DES",
   576 
   577                         "com.sun.crypto.provider.DESKeyFactory");
   577         /*
   578 
   578          * Internal in-house crypto algorithm used for
   579                     put("SecretKeyFactory.DESede",
   579          * the JCEKS keystore type.  Since this was developed
   580                         "com.sun.crypto.provider.DESedeKeyFactory");
   580          * internally, there isn't an OID corresponding to this
   581                     put("Alg.Alias.SecretKeyFactory.TripleDES", "DESede");
   581          * algorithm.
   582 
   582          */
   583                     put("SecretKeyFactory.PBEWithMD5AndDES",
   583         ps("SecretKeyFactory", "PBEWithMD5AndTripleDES",
   584                         "com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES"
   584                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndTripleDES",
   585                         );
   585                 null, null);
   586                     put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS5_MD5_DES,
   586 
   587                         "PBEWithMD5AndDES");
   587         ps("SecretKeyFactory", "PBEWithSHA1AndDESede",
   588                     put("Alg.Alias.SecretKeyFactory."+OID_PKCS5_MD5_DES,
   588                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede",
   589                         "PBEWithMD5AndDES");
   589                 pkcs12DESedeAliases, null);
   590 
   590 
   591                     put("Alg.Alias.SecretKeyFactory.PBE",
   591         ps("SecretKeyFactory", "PBEWithSHA1AndRC2_40",
   592                         "PBEWithMD5AndDES");
   592                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40",
   593 
   593                 pkcs12RC2_40Aliases, null);
   594                     /*
   594 
   595                      * Internal in-house crypto algorithm used for
   595         ps("SecretKeyFactory", "PBEWithSHA1AndRC2_128",
   596                      * the JCEKS keystore type.  Since this was developed
   596                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_128",
   597                      * internally, there isn't an OID corresponding to this
   597                 pkcs12RC2_128Aliases, null);
   598                      * algorithm.
   598 
   599                      */
   599         ps("SecretKeyFactory", "PBEWithSHA1AndRC4_40",
   600                     put("SecretKeyFactory.PBEWithMD5AndTripleDES",
   600                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC4_40",
   601                         "com.sun.crypto.provider.PBEKeyFactory$" +
   601                 pkcs12RC4_40Aliases,null);
   602                         "PBEWithMD5AndTripleDES"
   602 
   603                         );
   603         ps("SecretKeyFactory", "PBEWithSHA1AndRC4_128",
   604 
   604                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC4_128",
   605                     put("SecretKeyFactory.PBEWithSHA1AndDESede",
   605                 pkcs12RC4_128Aliases, null);
   606                         "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede"
   606 
   607                         );
   607         ps("SecretKeyFactory", "PBEWithHmacSHA1AndAES_128",
   608                     put("Alg.Alias.SecretKeyFactory.OID."+OID_PKCS12_DESede,
   608                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA1AndAES_128",
   609                         "PBEWithSHA1AndDESede");
   609                 null, null);
   610                     put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_DESede,
   610 
   611                         "PBEWithSHA1AndDESede");
   611         ps("SecretKeyFactory", "PBEWithHmacSHA224AndAES_128",
   612 
   612                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA224AndAES_128",
   613                     put("SecretKeyFactory.PBEWithSHA1AndRC2_40",
   613                 null, null);
   614                         "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40"
   614 
   615                         );
   615         ps("SecretKeyFactory", "PBEWithHmacSHA256AndAES_128",
   616                     put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC2_40,
   616                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA256AndAES_128",
   617                         "PBEWithSHA1AndRC2_40");
   617                 null, null);
   618                     put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC2_40,
   618 
   619                         "PBEWithSHA1AndRC2_40");
   619         ps("SecretKeyFactory", "PBEWithHmacSHA384AndAES_128",
   620 
   620                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA384AndAES_128",
   621                     put("SecretKeyFactory.PBEWithSHA1AndRC2_128",
   621                 null, null);
   622                         "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_128"
   622 
   623                         );
   623         ps("SecretKeyFactory", "PBEWithHmacSHA512AndAES_128",
   624                     put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC2_128,
   624                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA512AndAES_128",
   625                         "PBEWithSHA1AndRC2_128");
   625                 null, null);
   626                     put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC2_128,
   626 
   627                         "PBEWithSHA1AndRC2_128");
   627         ps("SecretKeyFactory", "PBEWithHmacSHA1AndAES_256",
   628 
   628                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA1AndAES_256",
   629                     put("SecretKeyFactory.PBEWithSHA1AndRC4_40",
   629                 null, null);
   630                         "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC4_40"
   630 
   631                         );
   631         ps("SecretKeyFactory", "PBEWithHmacSHA224AndAES_256",
   632 
   632                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA224AndAES_256",
   633                     put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC4_40,
   633                 null, null);
   634                         "PBEWithSHA1AndRC4_40");
   634 
   635                     put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC4_40,
   635         ps("SecretKeyFactory", "PBEWithHmacSHA256AndAES_256",
   636                         "PBEWithSHA1AndRC4_40");
   636                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA256AndAES_256",
   637 
   637                 null, null);
   638                     put("SecretKeyFactory.PBEWithSHA1AndRC4_128",
   638 
   639                         "com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC4_128"
   639         ps("SecretKeyFactory", "PBEWithHmacSHA384AndAES_256",
   640                         );
   640                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA384AndAES_256",
   641 
   641                 null, null);
   642                     put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS12_RC4_128,
   642 
   643                         "PBEWithSHA1AndRC4_128");
   643         ps("SecretKeyFactory", "PBEWithHmacSHA512AndAES_256",
   644                     put("Alg.Alias.SecretKeyFactory." + OID_PKCS12_RC4_128,
   644                 "com.sun.crypto.provider.PBEKeyFactory$PBEWithHmacSHA512AndAES_256",
   645                         "PBEWithSHA1AndRC4_128");
   645                 null, null);
   646 
   646 
   647                     put("SecretKeyFactory.PBEWithHmacSHA1AndAES_128",
   647         // PBKDF2
   648                         "com.sun.crypto.provider.PBEKeyFactory$" +
   648         ps("SecretKeyFactory", "PBKDF2WithHmacSHA1",
   649                         "PBEWithHmacSHA1AndAES_128");
   649                 "com.sun.crypto.provider.PBKDF2Core$HmacSHA1",
   650 
   650                 pkcs5PBKDF2Aliases, null);
   651                     put("SecretKeyFactory.PBEWithHmacSHA224AndAES_128",
   651         ps("SecretKeyFactory", "PBKDF2WithHmacSHA224",
   652                         "com.sun.crypto.provider.PBEKeyFactory$" +
   652                 "com.sun.crypto.provider.PBKDF2Core$HmacSHA224",
   653                         "PBEWithHmacSHA224AndAES_128");
   653                 null, null);
   654 
   654         ps("SecretKeyFactory", "PBKDF2WithHmacSHA256",
   655                     put("SecretKeyFactory.PBEWithHmacSHA256AndAES_128",
   655                 "com.sun.crypto.provider.PBKDF2Core$HmacSHA256",
   656                         "com.sun.crypto.provider.PBEKeyFactory$" +
   656                 null, null);
   657                         "PBEWithHmacSHA256AndAES_128");
   657         ps("SecretKeyFactory", "PBKDF2WithHmacSHA384",
   658 
   658                 "com.sun.crypto.provider.PBKDF2Core$HmacSHA384",
   659                     put("SecretKeyFactory.PBEWithHmacSHA384AndAES_128",
   659                 null, null);
   660                         "com.sun.crypto.provider.PBEKeyFactory$" +
   660         ps("SecretKeyFactory", "PBKDF2WithHmacSHA512",
   661                         "PBEWithHmacSHA384AndAES_128");
   661                 "com.sun.crypto.provider.PBKDF2Core$HmacSHA512",
   662 
   662                 null, null);
   663                     put("SecretKeyFactory.PBEWithHmacSHA512AndAES_128",
   663 
   664                         "com.sun.crypto.provider.PBEKeyFactory$" +
   664         /*
   665                         "PBEWithHmacSHA512AndAES_128");
   665          * MAC
   666 
   666          */
   667                     put("SecretKeyFactory.PBEWithHmacSHA1AndAES_256",
   667         attrs.clear();
   668                         "com.sun.crypto.provider.PBEKeyFactory$" +
   668         attrs.put("SupportedKeyFormats", "RAW");
   669                         "PBEWithHmacSHA1AndAES_256");
   669         ps("Mac", "HmacMD5", "com.sun.crypto.provider.HmacMD5", null, attrs);
   670 
   670         ps("Mac", "HmacSHA1", "com.sun.crypto.provider.HmacSHA1",
   671                     put("SecretKeyFactory.PBEWithHmacSHA224AndAES_256",
   671                 macSHA1Aliases, attrs);
   672                         "com.sun.crypto.provider.PBEKeyFactory$" +
   672         ps("Mac", "HmacSHA224", "com.sun.crypto.provider.HmacCore$HmacSHA224",
   673                         "PBEWithHmacSHA224AndAES_256");
   673                 macSHA224Aliases, attrs);
   674 
   674         ps("Mac", "HmacSHA256", "com.sun.crypto.provider.HmacCore$HmacSHA256",
   675                     put("SecretKeyFactory.PBEWithHmacSHA256AndAES_256",
   675                 macSHA256Aliases, attrs);
   676                         "com.sun.crypto.provider.PBEKeyFactory$" +
   676         ps("Mac", "HmacSHA384", "com.sun.crypto.provider.HmacCore$HmacSHA384",
   677                         "PBEWithHmacSHA256AndAES_256");
   677                 macSHA384Aliases, attrs);
   678 
   678         ps("Mac", "HmacSHA512", "com.sun.crypto.provider.HmacCore$HmacSHA512",
   679                     put("SecretKeyFactory.PBEWithHmacSHA384AndAES_256",
   679                 macSHA512Aliases, attrs);
   680                         "com.sun.crypto.provider.PBEKeyFactory$" +
   680         // TODO: aliases with OIDs
   681                         "PBEWithHmacSHA384AndAES_256");
   681         ps("Mac", "HmacSHA512/224",
   682 
   682                 "com.sun.crypto.provider.HmacCore$HmacSHA512_224",
   683                     put("SecretKeyFactory.PBEWithHmacSHA512AndAES_256",
   683                 null, attrs);
   684                         "com.sun.crypto.provider.PBEKeyFactory$" +
   684         ps("Mac", "HmacSHA512/256",
   685                         "PBEWithHmacSHA512AndAES_256");
   685                 "com.sun.crypto.provider.HmacCore$HmacSHA512_256",
   686 
   686                 null, attrs);
   687                     // PBKDF2
   687         ps("Mac", "HmacPBESHA1", "com.sun.crypto.provider.HmacPKCS12PBESHA1",
   688 
   688                 null, attrs);
   689                     put("SecretKeyFactory.PBKDF2WithHmacSHA1",
   689         // PBMAC1
   690                         "com.sun.crypto.provider.PBKDF2Core$HmacSHA1");
   690         ps("Mac", "PBEWithHmacSHA1",
   691                     put("Alg.Alias.SecretKeyFactory.OID." + OID_PKCS5_PBKDF2,
   691                 "com.sun.crypto.provider.PBMAC1Core$HmacSHA1", null, attrs);
   692                         "PBKDF2WithHmacSHA1");
   692         ps("Mac", "PBEWithHmacSHA224",
   693                     put("Alg.Alias.SecretKeyFactory." + OID_PKCS5_PBKDF2,
   693                 "com.sun.crypto.provider.PBMAC1Core$HmacSHA224", null, attrs);
   694                         "PBKDF2WithHmacSHA1");
   694         ps("Mac", "PBEWithHmacSHA256",
   695 
   695                 "com.sun.crypto.provider.PBMAC1Core$HmacSHA256", null, attrs);
   696                     put("SecretKeyFactory.PBKDF2WithHmacSHA224",
   696         ps("Mac", "PBEWithHmacSHA384",
   697                         "com.sun.crypto.provider.PBKDF2Core$HmacSHA224");
   697                 "com.sun.crypto.provider.PBMAC1Core$HmacSHA384", null, attrs);
   698                     put("SecretKeyFactory.PBKDF2WithHmacSHA256",
   698         ps("Mac", "PBEWithHmacSHA512",
   699                         "com.sun.crypto.provider.PBKDF2Core$HmacSHA256");
   699                 "com.sun.crypto.provider.PBMAC1Core$HmacSHA512", null, attrs);
   700                     put("SecretKeyFactory.PBKDF2WithHmacSHA384",
   700         ps("Mac", "SslMacMD5",
   701                         "com.sun.crypto.provider.PBKDF2Core$HmacSHA384");
   701                 "com.sun.crypto.provider.SslMacCore$SslMacMD5", null, attrs);
   702                     put("SecretKeyFactory.PBKDF2WithHmacSHA512",
   702         ps("Mac", "SslMacSHA1",
   703                         "com.sun.crypto.provider.PBKDF2Core$HmacSHA512");
   703                 "com.sun.crypto.provider.SslMacCore$SslMacSHA1", null, attrs);
   704 
   704 
   705                     /*
   705         /*
   706                      * MAC
   706          * KeyStore
   707                      */
   707          */
   708                     put("Mac.HmacMD5", "com.sun.crypto.provider.HmacMD5");
   708         ps("KeyStore", "JCEKS",
   709                     put("Mac.HmacSHA1", "com.sun.crypto.provider.HmacSHA1");
   709                 "com.sun.crypto.provider.JceKeyStore",
   710                     put("Alg.Alias.Mac.OID.1.2.840.113549.2.7", "HmacSHA1");
   710                 null, null);
   711                     put("Alg.Alias.Mac.1.2.840.113549.2.7", "HmacSHA1");
   711 
   712                     put("Mac.HmacSHA224",
   712         /*
   713                         "com.sun.crypto.provider.HmacCore$HmacSHA224");
   713          * SSL/TLS mechanisms
   714                     put("Alg.Alias.Mac.OID.1.2.840.113549.2.8", "HmacSHA224");
   714          *
   715                     put("Alg.Alias.Mac.1.2.840.113549.2.8", "HmacSHA224");
   715          * These are strictly internal implementations and may
   716                     put("Mac.HmacSHA256",
   716          * be changed at any time.  These names were chosen
   717                         "com.sun.crypto.provider.HmacCore$HmacSHA256");
   717          * because PKCS11/SunPKCS11 does not yet have TLS1.2
   718                     put("Alg.Alias.Mac.OID.1.2.840.113549.2.9", "HmacSHA256");
   718          * mechanisms, and it will cause calls to come here.
   719                     put("Alg.Alias.Mac.1.2.840.113549.2.9", "HmacSHA256");
   719          */
   720                     put("Mac.HmacSHA384",
   720         ps("KeyGenerator", "SunTlsPrf",
   721                         "com.sun.crypto.provider.HmacCore$HmacSHA384");
   721                 "com.sun.crypto.provider.TlsPrfGenerator$V10",
   722                     put("Alg.Alias.Mac.OID.1.2.840.113549.2.10", "HmacSHA384");
   722                 null, null);
   723                     put("Alg.Alias.Mac.1.2.840.113549.2.10", "HmacSHA384");
   723         ps("KeyGenerator", "SunTls12Prf",
   724                     put("Mac.HmacSHA512",
   724                 "com.sun.crypto.provider.TlsPrfGenerator$V12",
   725                         "com.sun.crypto.provider.HmacCore$HmacSHA512");
   725                 null, null);
   726                     put("Alg.Alias.Mac.OID.1.2.840.113549.2.11", "HmacSHA512");
   726 
   727                     put("Alg.Alias.Mac.1.2.840.113549.2.11", "HmacSHA512");
   727         ps("KeyGenerator", "SunTlsMasterSecret",
   728 
   728                 "com.sun.crypto.provider.TlsMasterSecretGenerator",
   729                     // TODO: aliases with OIDs
   729                 createAliases("SunTls12MasterSecret",
   730                     put("Mac.HmacSHA512/224",
   730                     "SunTlsExtendedMasterSecret"), null);
   731                             "com.sun.crypto.provider.HmacCore$HmacSHA512_224");
   731 
   732                     put("Mac.HmacSHA512/256",
   732         ps("KeyGenerator", "SunTlsKeyMaterial",
   733                             "com.sun.crypto.provider.HmacCore$HmacSHA512_256");
   733                 "com.sun.crypto.provider.TlsKeyMaterialGenerator",
   734 
   734                 createAliases("SunTls12KeyMaterial"), null);
   735                     put("Mac.HmacPBESHA1",
   735 
   736                         "com.sun.crypto.provider.HmacPKCS12PBESHA1");
   736         ps("KeyGenerator", "SunTlsRsaPremasterSecret",
   737 
   737                 "com.sun.crypto.provider.TlsRsaPremasterSecretGenerator",
   738                     // PBMAC1
   738                 createAliases("SunTls12RsaPremasterSecret"), null);
   739 
       
   740                     put("Mac.PBEWithHmacSHA1",
       
   741                         "com.sun.crypto.provider.PBMAC1Core$HmacSHA1");
       
   742                     put("Mac.PBEWithHmacSHA224",
       
   743                         "com.sun.crypto.provider.PBMAC1Core$HmacSHA224");
       
   744                     put("Mac.PBEWithHmacSHA256",
       
   745                         "com.sun.crypto.provider.PBMAC1Core$HmacSHA256");
       
   746                     put("Mac.PBEWithHmacSHA384",
       
   747                         "com.sun.crypto.provider.PBMAC1Core$HmacSHA384");
       
   748                     put("Mac.PBEWithHmacSHA512",
       
   749                         "com.sun.crypto.provider.PBMAC1Core$HmacSHA512");
       
   750 
       
   751                     put("Mac.SslMacMD5",
       
   752                         "com.sun.crypto.provider.SslMacCore$SslMacMD5");
       
   753                     put("Mac.SslMacSHA1",
       
   754                         "com.sun.crypto.provider.SslMacCore$SslMacSHA1");
       
   755 
       
   756                     put("Mac.HmacMD5 SupportedKeyFormats", "RAW");
       
   757                     put("Mac.HmacSHA1 SupportedKeyFormats", "RAW");
       
   758                     put("Mac.HmacSHA224 SupportedKeyFormats", "RAW");
       
   759                     put("Mac.HmacSHA256 SupportedKeyFormats", "RAW");
       
   760                     put("Mac.HmacSHA384 SupportedKeyFormats", "RAW");
       
   761                     put("Mac.HmacSHA512 SupportedKeyFormats", "RAW");
       
   762                     put("Mac.HmacPBESHA1 SupportedKeyFormats", "RAW");
       
   763                     put("Mac.PBEWithHmacSHA1 SupportedKeyFormatS", "RAW");
       
   764                     put("Mac.PBEWithHmacSHA224 SupportedKeyFormats", "RAW");
       
   765                     put("Mac.PBEWithHmacSHA256 SupportedKeyFormats", "RAW");
       
   766                     put("Mac.PBEWithHmacSHA384 SupportedKeyFormats", "RAW");
       
   767                     put("Mac.PBEWithHmacSHA512 SupportedKeyFormats", "RAW");
       
   768                     put("Mac.SslMacMD5 SupportedKeyFormats", "RAW");
       
   769                     put("Mac.SslMacSHA1 SupportedKeyFormats", "RAW");
       
   770 
       
   771                     /*
       
   772                      * KeyStore
       
   773                      */
       
   774                     put("KeyStore.JCEKS", "com.sun.crypto.provider.JceKeyStore");
       
   775 
       
   776                     /*
       
   777                      * SSL/TLS mechanisms
       
   778                      *
       
   779                      * These are strictly internal implementations and may
       
   780                      * be changed at any time.  These names were chosen
       
   781                      * because PKCS11/SunPKCS11 does not yet have TLS1.2
       
   782                      * mechanisms, and it will cause calls to come here.
       
   783                      */
       
   784                     put("KeyGenerator.SunTlsPrf",
       
   785                             "com.sun.crypto.provider.TlsPrfGenerator$V10");
       
   786                     put("KeyGenerator.SunTls12Prf",
       
   787                             "com.sun.crypto.provider.TlsPrfGenerator$V12");
       
   788 
       
   789                     put("KeyGenerator.SunTlsMasterSecret",
       
   790                         "com.sun.crypto.provider.TlsMasterSecretGenerator");
       
   791                     put("Alg.Alias.KeyGenerator.SunTls12MasterSecret",
       
   792                         "SunTlsMasterSecret");
       
   793                     put("Alg.Alias.KeyGenerator.SunTlsExtendedMasterSecret",
       
   794                         "SunTlsMasterSecret");
       
   795 
       
   796                     put("KeyGenerator.SunTlsKeyMaterial",
       
   797                         "com.sun.crypto.provider.TlsKeyMaterialGenerator");
       
   798                     put("Alg.Alias.KeyGenerator.SunTls12KeyMaterial",
       
   799                         "SunTlsKeyMaterial");
       
   800 
       
   801                     put("KeyGenerator.SunTlsRsaPremasterSecret",
       
   802                         "com.sun.crypto.provider.TlsRsaPremasterSecretGenerator");
       
   803                     put("Alg.Alias.KeyGenerator.SunTls12RsaPremasterSecret",
       
   804                         "SunTlsRsaPremasterSecret");
       
   805 
       
   806                     return null;
       
   807                 }
       
   808             });
       
   809 
       
   810         if (instance == null) {
       
   811             instance = this;
       
   812         }
       
   813     }
   739     }
   814 
   740 
   815     // Return the instance of this class or create one if needed.
   741     // Return the instance of this class or create one if needed.
   816     static SunJCE getInstance() {
   742     static SunJCE getInstance() {
   817         if (instance == null) {
   743         if (instance == null) {