src/java.base/share/classes/com/sun/crypto/provider/SunJCE.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  40 
  41 /**
  42  * Defines the "SunJCE" provider.
  43  *
  44  * Supported algorithms and their names:
  45  *
  46  * - RSA encryption (PKCS#1 v1.5 and raw)
  47  *
  48  * - DES
  49  *
  50  * - DES-EDE
  51  *
  52  * - AES
  53  *
  54  * - Blowfish
  55  *
  56  * - RC2
  57  *
  58  * - ARCFOUR (RC4 compatible)
  59  *


  60  * - Cipher modes ECB, CBC, CFB, OFB, PCBC, CTR, and CTS for all block ciphers
  61  *   and mode GCM for AES cipher
  62  *
  63  * - Cipher padding ISO10126Padding for non-PKCS#5 block ciphers and
  64  *   NoPadding and PKCS5Padding for all block ciphers
  65  *
  66  * - Password-based Encryption (PBE)
  67  *
  68  * - Diffie-Hellman Key Agreement
  69  *
  70  * - HMAC-MD5, HMAC-SHA1, HMAC-SHA-224, HMAC-SHA-256, HMAC-SHA-384, HMAC-SHA-512
  71  *
  72  */
  73 
  74 public final class SunJCE extends Provider {
  75 
  76     private static final long serialVersionUID = 6812507587804302833L;
  77 
  78     private static final String info = "SunJCE Provider " +
  79     "(implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, "


 317                     put("Cipher.AESWrap_192", "com.sun.crypto.provider.AESWrapCipher$AES192");
 318                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.25", "AESWrap_192");
 319                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.25", "AESWrap_192");
 320                     put("Cipher.AESWrap_256", "com.sun.crypto.provider.AESWrapCipher$AES256");
 321                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.45", "AESWrap_256");
 322                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.45", "AESWrap_256");
 323 
 324                     put("Cipher.RC2",
 325                         "com.sun.crypto.provider.RC2Cipher");
 326                     put("Cipher.RC2 SupportedModes", BLOCK_MODES);
 327                     put("Cipher.RC2 SupportedPaddings", BLOCK_PADS);
 328                     put("Cipher.RC2 SupportedKeyFormats", "RAW");
 329 
 330                     put("Cipher.ARCFOUR",
 331                         "com.sun.crypto.provider.ARCFOURCipher");
 332                     put("Alg.Alias.Cipher.RC4", "ARCFOUR");
 333                     put("Cipher.ARCFOUR SupportedModes", "ECB");
 334                     put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
 335                     put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
 336 









 337                     /*
 338                      * Key(pair) Generator engines
 339                      */
 340                     put("KeyGenerator.DES",
 341                         "com.sun.crypto.provider.DESKeyGenerator");
 342 
 343                     put("KeyGenerator.DESede",
 344                         "com.sun.crypto.provider.DESedeKeyGenerator");
 345                     put("Alg.Alias.KeyGenerator.TripleDES", "DESede");
 346 
 347                     put("KeyGenerator.Blowfish",
 348                         "com.sun.crypto.provider.BlowfishKeyGenerator");
 349 
 350                     put("KeyGenerator.AES",
 351                         "com.sun.crypto.provider.AESKeyGenerator");
 352                     put("Alg.Alias.KeyGenerator.Rijndael", "AES");
 353 
 354                     put("KeyGenerator.RC2",
 355                         "com.sun.crypto.provider.KeyGeneratorCore$" +
 356                         "RC2KeyGenerator");
 357                     put("KeyGenerator.ARCFOUR",
 358                         "com.sun.crypto.provider.KeyGeneratorCore$" +
 359                         "ARCFOURKeyGenerator");
 360                     put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
 361 




 362                     put("KeyGenerator.HmacMD5",
 363                         "com.sun.crypto.provider.HmacMD5KeyGenerator");
 364 
 365                     put("KeyGenerator.HmacSHA1",
 366                         "com.sun.crypto.provider.HmacSHA1KeyGenerator");
 367                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.7", "HmacSHA1");
 368                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.7", "HmacSHA1");
 369 
 370                     put("KeyGenerator.HmacSHA224",
 371                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA224");
 372                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.8", "HmacSHA224");
 373                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.8", "HmacSHA224");
 374 
 375                     put("KeyGenerator.HmacSHA256",
 376                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA256");
 377                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.9", "HmacSHA256");
 378                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.9", "HmacSHA256");
 379 
 380                     put("KeyGenerator.HmacSHA384",
 381                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA384");


 521                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA384AndAES_256");
 522 
 523                     put("AlgorithmParameters.PBEWithHmacSHA512AndAES_256",
 524                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA512AndAES_256");
 525 
 526                     put("AlgorithmParameters.Blowfish",
 527                         "com.sun.crypto.provider.BlowfishParameters");
 528 
 529                     put("AlgorithmParameters.AES",
 530                         "com.sun.crypto.provider.AESParameters");
 531                     put("Alg.Alias.AlgorithmParameters.Rijndael", "AES");
 532                     put("AlgorithmParameters.GCM",
 533                         "com.sun.crypto.provider.GCMParameters");
 534 
 535 
 536                     put("AlgorithmParameters.RC2",
 537                         "com.sun.crypto.provider.RC2Parameters");
 538 
 539                     put("AlgorithmParameters.OAEP",
 540                         "com.sun.crypto.provider.OAEPParameters");



 541 
 542                     /*
 543                      * Key factories
 544                      */
 545                     put("KeyFactory.DiffieHellman",
 546                         "com.sun.crypto.provider.DHKeyFactory");
 547                     put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
 548                     put("Alg.Alias.KeyFactory.OID."+OID_PKCS3,
 549                         "DiffieHellman");
 550                     put("Alg.Alias.KeyFactory."+OID_PKCS3, "DiffieHellman");
 551 
 552                     /*
 553                      * Secret-key factories
 554                      */
 555                     put("SecretKeyFactory.DES",
 556                         "com.sun.crypto.provider.DESKeyFactory");
 557 
 558                     put("SecretKeyFactory.DESede",
 559                         "com.sun.crypto.provider.DESedeKeyFactory");
 560                     put("Alg.Alias.SecretKeyFactory.TripleDES", "DESede");


   1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  40 
  41 /**
  42  * Defines the "SunJCE" provider.
  43  *
  44  * Supported algorithms and their names:
  45  *
  46  * - RSA encryption (PKCS#1 v1.5 and raw)
  47  *
  48  * - DES
  49  *
  50  * - DES-EDE
  51  *
  52  * - AES
  53  *
  54  * - Blowfish
  55  *
  56  * - RC2
  57  *
  58  * - ARCFOUR (RC4 compatible)
  59  *
  60  * - ChaCha20 (Stream cipher only and in AEAD mode with Poly1305)
  61  *
  62  * - Cipher modes ECB, CBC, CFB, OFB, PCBC, CTR, and CTS for all block ciphers
  63  *   and mode GCM for AES cipher
  64  *
  65  * - Cipher padding ISO10126Padding for non-PKCS#5 block ciphers and
  66  *   NoPadding and PKCS5Padding for all block ciphers
  67  *
  68  * - Password-based Encryption (PBE)
  69  *
  70  * - Diffie-Hellman Key Agreement
  71  *
  72  * - HMAC-MD5, HMAC-SHA1, HMAC-SHA-224, HMAC-SHA-256, HMAC-SHA-384, HMAC-SHA-512
  73  *
  74  */
  75 
  76 public final class SunJCE extends Provider {
  77 
  78     private static final long serialVersionUID = 6812507587804302833L;
  79 
  80     private static final String info = "SunJCE Provider " +
  81     "(implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, "


 319                     put("Cipher.AESWrap_192", "com.sun.crypto.provider.AESWrapCipher$AES192");
 320                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.25", "AESWrap_192");
 321                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.25", "AESWrap_192");
 322                     put("Cipher.AESWrap_256", "com.sun.crypto.provider.AESWrapCipher$AES256");
 323                     put("Alg.Alias.Cipher.2.16.840.1.101.3.4.1.45", "AESWrap_256");
 324                     put("Alg.Alias.Cipher.OID.2.16.840.1.101.3.4.1.45", "AESWrap_256");
 325 
 326                     put("Cipher.RC2",
 327                         "com.sun.crypto.provider.RC2Cipher");
 328                     put("Cipher.RC2 SupportedModes", BLOCK_MODES);
 329                     put("Cipher.RC2 SupportedPaddings", BLOCK_PADS);
 330                     put("Cipher.RC2 SupportedKeyFormats", "RAW");
 331 
 332                     put("Cipher.ARCFOUR",
 333                         "com.sun.crypto.provider.ARCFOURCipher");
 334                     put("Alg.Alias.Cipher.RC4", "ARCFOUR");
 335                     put("Cipher.ARCFOUR SupportedModes", "ECB");
 336                     put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
 337                     put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
 338 
 339                     put("Cipher.ChaCha20",
 340                         "com.sun.crypto.provider.ChaCha20Cipher$ChaCha20Only");
 341                     put("Cipher.ChaCha20 SupportedKeyFormats", "RAW");
 342                     put("Cipher.ChaCha20-Poly1305",
 343                         "com.sun.crypto.provider.ChaCha20Cipher$ChaCha20Poly1305");
 344                     put("Cipher.ChaCha20-Poly1305 SupportedKeyFormats", "RAW");
 345                     put("Alg.Alias.Cipher.1.2.840.113549.1.9.16.3.18", "ChaCha20-Poly1305");
 346                     put("Alg.Alias.Cipher.OID.1.2.840.113549.1.9.16.3.18", "ChaCha20-Poly1305");
 347 
 348                     /*
 349                      * Key(pair) Generator engines
 350                      */
 351                     put("KeyGenerator.DES",
 352                         "com.sun.crypto.provider.DESKeyGenerator");
 353 
 354                     put("KeyGenerator.DESede",
 355                         "com.sun.crypto.provider.DESedeKeyGenerator");
 356                     put("Alg.Alias.KeyGenerator.TripleDES", "DESede");
 357 
 358                     put("KeyGenerator.Blowfish",
 359                         "com.sun.crypto.provider.BlowfishKeyGenerator");
 360 
 361                     put("KeyGenerator.AES",
 362                         "com.sun.crypto.provider.AESKeyGenerator");
 363                     put("Alg.Alias.KeyGenerator.Rijndael", "AES");
 364 
 365                     put("KeyGenerator.RC2",
 366                         "com.sun.crypto.provider.KeyGeneratorCore$" +
 367                         "RC2KeyGenerator");
 368                     put("KeyGenerator.ARCFOUR",
 369                         "com.sun.crypto.provider.KeyGeneratorCore$" +
 370                         "ARCFOURKeyGenerator");
 371                     put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
 372 
 373                     put("KeyGenerator.ChaCha20",
 374                         "com.sun.crypto.provider.KeyGeneratorCore$" +
 375                         "ChaCha20KeyGenerator");
 376 
 377                     put("KeyGenerator.HmacMD5",
 378                         "com.sun.crypto.provider.HmacMD5KeyGenerator");
 379 
 380                     put("KeyGenerator.HmacSHA1",
 381                         "com.sun.crypto.provider.HmacSHA1KeyGenerator");
 382                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.7", "HmacSHA1");
 383                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.7", "HmacSHA1");
 384 
 385                     put("KeyGenerator.HmacSHA224",
 386                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA224");
 387                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.8", "HmacSHA224");
 388                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.8", "HmacSHA224");
 389 
 390                     put("KeyGenerator.HmacSHA256",
 391                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA256");
 392                     put("Alg.Alias.KeyGenerator.OID.1.2.840.113549.2.9", "HmacSHA256");
 393                     put("Alg.Alias.KeyGenerator.1.2.840.113549.2.9", "HmacSHA256");
 394 
 395                     put("KeyGenerator.HmacSHA384",
 396                         "com.sun.crypto.provider.KeyGeneratorCore$HmacSHA2KG$SHA384");


 536                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA384AndAES_256");
 537 
 538                     put("AlgorithmParameters.PBEWithHmacSHA512AndAES_256",
 539                         "com.sun.crypto.provider.PBES2Parameters$HmacSHA512AndAES_256");
 540 
 541                     put("AlgorithmParameters.Blowfish",
 542                         "com.sun.crypto.provider.BlowfishParameters");
 543 
 544                     put("AlgorithmParameters.AES",
 545                         "com.sun.crypto.provider.AESParameters");
 546                     put("Alg.Alias.AlgorithmParameters.Rijndael", "AES");
 547                     put("AlgorithmParameters.GCM",
 548                         "com.sun.crypto.provider.GCMParameters");
 549 
 550 
 551                     put("AlgorithmParameters.RC2",
 552                         "com.sun.crypto.provider.RC2Parameters");
 553 
 554                     put("AlgorithmParameters.OAEP",
 555                         "com.sun.crypto.provider.OAEPParameters");
 556 
 557                     put("AlgorithmParameters.ChaCha20-Poly1305",
 558                         "com.sun.crypto.provider.ChaCha20Poly1305Parameters");
 559 
 560                     /*
 561                      * Key factories
 562                      */
 563                     put("KeyFactory.DiffieHellman",
 564                         "com.sun.crypto.provider.DHKeyFactory");
 565                     put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
 566                     put("Alg.Alias.KeyFactory.OID."+OID_PKCS3,
 567                         "DiffieHellman");
 568                     put("Alg.Alias.KeyFactory."+OID_PKCS3, "DiffieHellman");
 569 
 570                     /*
 571                      * Secret-key factories
 572                      */
 573                     put("SecretKeyFactory.DES",
 574                         "com.sun.crypto.provider.DESKeyFactory");
 575 
 576                     put("SecretKeyFactory.DESede",
 577                         "com.sun.crypto.provider.DESedeKeyFactory");
 578                     put("Alg.Alias.SecretKeyFactory.TripleDES", "DESede");