The following topics are covered:
SunPKCS11
ProviderSUN
ProviderSunRsaSign
ProviderSunJSSE
ProviderSunJCE
ProviderSunJGSS
ProviderSunSASL
ProviderXMLDSig
ProviderSunPCSC
ProviderSunMSCAPI
ProviderSunEC
ProviderOracleUcrypto
ProviderApple
ProviderNote: The Standard Names Documentation contains more information about the standard names used in this document.
IntroductionThe Java platform defines a set of APIs spanning major security areas, including cryptography, public key infrastructure, authentication, secure communication, and access control. These APIs allow developers to easily integrate security mechanisms into their application code. The Java Cryptography Architecture (JCA) and its Provider Architecture is a core concept of the Java Development Kit (JDK). It is assumed readers have a solid understanding of this architecture.
This document describes the technical details of the providers shipped as part of Oracle's Java Environment.
Reminder: Cryptographic implementations in the JDK are distributed through several different providers (SUN
, SunJSSE
, SunJCE
, SunRsaSign
) for both historical reasons and by the types of services provided. General purpose applications SHOULD NOT request cryptographic services from specific providers. That is:
getInstance("...", "SunJCE"); // not recommended
versus
getInstance("..."); // recommended
Otherwise, applications are tied to specific providers that may not be available on other Java implementations. They also might not be able to take advantage of available optimized providers (for example, hardware accelerators via PKCS11 or native OS implementations such as Microsoft's MSCAPI) that have a higher preference order than the specific requested provider.
Import Limits on Cryptographic AlgorithmsBy default, an application can use cryptographic algorithms of any strength. However, due to import regulations in some locations, you may have to limit the strength of those algorithms. The JDK provides two different sets of jurisdiction policy files, "limited" and "unlimited", in the directory <java-home>/jre/lib/security/policy
that determine the strength of cryptographic algorithms. Information about jurisdiction policy files and how to activate them is available in Appendix C: Cryptographic Strength Configuration.
Consult your export/import control counsel or attorney to determine the exact requirements for your location.
For the "limited" configuration, the following table lists the maximum key sizes allowed by the "limited" set of jurisdiction policy files:
Algorithm Maximum Keysize DES 64 DESede * RC2 128 RC4 128 RC5 128 RSA * all others 128 Cipher TransformationsThe javax.crypto.Cipher.getInstance(String transformation)
factory method generates Cipher
s using transformations of the form algorithm/mode/padding. If the mode/padding are omitted, the SunJCE
and SunPKCS11
providers use ECB as the default mode and PKCS5Padding as the default padding for many symmetric ciphers.
It is recommended to use transformations that fully specify the algorithm, mode, and padding instead of relying on the defaults.
Note: ECB works well for single blocks of data and can be parallelized, but absolutely should not be used for multiple blocks of data.
SecureRandom ImplementationsThe following table lists the default preference order of the available SecureRandom
implementations.
* The SunPKCS11
provider is available on all platforms, but is only enabled by default on Solaris as it is the only OS with a native PKCS11 implementation automatically installed and configured. On other platforms, applications or deployers must specifically install and configure a native PKCS11 library, and then configure and enable the SunPKCS11
provider to use it.
** On Solaris, Linux, and macOS, if the entropy gathering device in java.security
is set to file:/dev/urandom
or file:/dev/random
, then NativePRNG is preferred to SHA1PRNG. Otherwise, SHA1PRNG is preferred.
*** There is currently no NativePRNG on Windows. Access to the equivalent functionality is via the SunMSCAPI
provider.
If there are no SecureRandom
implementations registered in the JCA framework, java.security.SecureRandom
will use the hardcoded SHA1PRNG.
SunPKCS11
Provider
The Cryptographic Token Interface Standard (PKCS#11) provides native programming interfaces to cryptographic mechanisms, such as hardware cryptographic accelerators and Smart Cards. When properly configured, the SunPKCS11
provider enables applications to use the standard JCA/JCE APIs to access native PKCS#11 libraries. The SunPKCS11
provider itself does not contain cryptographic functionality, it is simply a conduit between the Java environment and the native PKCS11 providers. The Java PKCS#11 Reference Guide has a much more detailed treatment of this provider.
SUN
Provider
JDK 1.1 introduced the Provider
architecture. The first JDK provider was named SUN
, and contained two types of cryptographic services (MessageDigest
s and Signature
s). In later releases, other mechanisms were added (SecureRandom
number generators, KeyPairGenerator
s, KeyFactory
s, and so on.).
United States export regulations in effect at the time placed significant restrictions on the type of cryptographic functionality that could be made available internationally in the JDK. For this reason, the SUN
provider has historically contained cryptographic engines that did not directly encrypt or decrypt data.
The following algorithms are available in the SUN
provider:
AlgorithmParameterGenerator
DSA AlgorithmParameters
DSA CertificateFactory
X.509 CertPathBuilder
PKIX CertPathValidator
PKIX CertStore
Collection
Configuration
JavaLoginConfig KeyFactory
DSA KeyPairGenerator
DSA KeyStore
JKS
MessageDigest
MD2
Policy
JavaPolicy SecureRandom
SHA1PRNG (Initial seeding is currently done via a combination of system attributes and the java.security
entropy gathering device)
nextBytes()
uses /dev/urandom
, generateSeed()
uses /dev/random
)
nextBytes()
and generateSeed()
use /dev/random
)
nextBytes()
and generateSeed()
use /dev/urandom
)
Signature
NONEwithDSA
Note: For signature generation, if the security strength of the digest algorithm is weaker than the security strength of the key used to sign the signature (for example, using (2048, 256)-bit DSA keys with the SHA1withDSA signature), then the operation will fail with the error message: "The security strength of SHA1 digest algorithm is not sufficient for this key size."
The following table lists OIDs associated with SHA Message Digests:
SHA Message Digest OID SHA-224 2.16.840.1.101.3.4.2.4 SHA-256 2.16.840.1.101.3.4.2.1 SHA-384 2.16.840.1.101.3.4.2.2 SHA-512 2.16.840.1.101.3.4.2.3 SHA-512/224 2.16.840.1.101.3.4.2.5 SHA-512/256 2.16.840.1.101.3.4.2.6The following table lists OIDs associated with DSA Signatures:
DSA Signature OID SHA1withDSA 1.2.840.10040.4.3The SUN
provider uses the following default keysizes (in bits) and enforces the following restrictions:
KeyPairGenerator
Alg. Name Default Keysize Restrictions/Comments DSA 2048 Keysize must be a multiple of 64, ranging from 512 to 1024 (inclusive), or 2048.AlgorithmParameterGenerator
Alg. Name Default Keysize Restrictions/Comments DSA 2048 Keysize must be a multiple of 64, ranging from 512 to 1024 (inclusive), or 2048.CertificateFactory
/CertPathBuilder
/CertPathValidator
/CertStore
Implementations
Additional details on the SUN
provider implementations for CertificateFactory
, CertPathBuilder
, CertPathValidator
and CertStore
are documented in Appendix B of the PKI Programmer's Guide.
SunRsaSign
Provider
The SunRsaSign
provider was introduced in JDK 1.3 as an enhanced replacement for the RSA signatures in the SunJSSE
provider.
The following algorithms are available in the SunRsaSign
provider:
AlgorithmParameters
RSASSA-PSS KeyFactory
RSA
KeyPairGenerator
RSA
Signature
MD2withRSA
The SunRsaSign
provider uses the following default keysize (in bits) and enforces the following restriction:
KeyPairGenerator
Alg. Name Default Keysize Restrictions/Comments RSA and RSASSA-PSS 2048 Keysize must range between 512 and 16384 bits. If the key size exceeds 3072, then the public exponent length cannot exceed 64 bits. TheSunJSSE
Provider
The Java Secure Socket Extension (JSSE) was originally released as a separate "Optional Package" (also briefly known as a "Standard Extension"), and was available for JDK 1.2.n and 1.3.n. The SunJSSE
provider was introduced as part of this release.
In earlier JDK releases, there were no RSA signature providers available in the JDK, therefore SunJSSE
had to provide its own RSA implementation in order to use commonly available RSA-based certificates. JDK 5 introduced the SunRsaSign
provider, which provides all the functionality (and more) of the SunJSSE
provider. Applications targeted at JDK 5.0 and later should request instances of the SunRsaSign
provider instead. For backward compatibility, the RSA algorithms are still available through this provider, but are actually implemented in the SunRsaSign
provider.
The following algorithms are available in the SunJSSE
provider:
KeyFactory
RSA KeyManagerFactory
SunX509: A factory for X509ExtendedKeyManager
instances that manage X.509 certificate-based key pairs for local side authentication according to the rules defined by the IETF PKIX working group in RFC 3280 or its successor. This KeyManagerFactory
supports initialization using a Keystore
object, but does not currently support initialization using the class javax.net.ssl.ManagerFactoryParameters
.
PKIX: A factory for X509ExtendedKeyManager
instances that manage X.509 certificate-based key pairs for local side authentication according to the rules defined by the IETF PKIX working group in RFC 3280 or its successor. This KeyManagerFactory
currently supports initialization using a KeyStore
object or javax.net.ssl.KeyStoreBuilderParameters
.
KeyPairGenerator
RSA KeyStore
PKCS12Footnote 1 Signature
MD2withRSA
SSLContext
SSLv3
TrustManagerFactory
SunX509: A factory for X509ExtendedTrustManager
instances that validate certificate chains according to the rules defined by the IETF PKIX working group in RFC 3280 or its successor. This TrustManagerFactory
supports initialization using a Keystore
object, but does not currently support initialization using the class javax.net.ssl.ManagerFactoryParameters
.
PKIX: A factory for X509ExtendedTrustManager
instances that validate certificate chains according to the rules defined by the IETF PKIX working group in RFC 3280 or its successor. This TrustManagerFactory
currently supports initialization using a KeyStore
object or javax.net.ssl.CertPathTrustManagerParameters
.
Footnote 1 The PKCS12 KeyStore
implementation does not support the KeyBag
type.
The following table lists the protocol
parameters that the SunJSSE
provider supports:
Footnote 1 - TLS 1.0 and 1.1 are versions of the TLS protocol that are no longer considered secure and have been superseded by more secure and modern versions (TLS 1.2 and 1.3). These versions have now been disabled by default. If you encounter issues, you can, at your own risk, re-enable the versions by removing TLSv1 or TLSv1.1 from the jdk.tls.disabledAlgorithms
Security Property in the java.security
configuration file.
Footnote 2 - The SSLv3, TLSv1, TLSv1.1 and TLSv1.2 protocols allow you to send SSLv3, TLSv1, TLSv1.1 and TLSv1.2 ClientHellos encapsulated in an SSLv2 format hello by using the SSLv2Hello pseudo-protocol. The following table illustrates which connection combinations are possible when using SSLv2Hellos:
Client Server Connection enabled enabled Y disabled enabled Y (most interoperable:SunJSSE
default) enabled disabled N disabled disabled Y
Note: The protocols available by default in a JDK release change as new protocols are developed and old protocols are found to be less effective than previously thought. The JDK uses two mechanisms to restrict the availability of these protocols:
jdk.tls.disabledAlgorithms
Security Property: This disables categories of protocols and cipher suites. For example, if this Security Property contains SSLv3
, then the SSLv3 protocol would be disabled. See Disabled and Restricted Cryptographic Algorithms for information about this Security Property.The following are the currently implemented SunJSSE cipher suites for this JDK release, sorted by order of preference. Not all of these cipher suites are available for use by default.
Prior to the JDK 7 release, the SSL/TLS implementation did not check the version number in PreMasterSecret, and the SSL/TLS client did not send the correct version number by default. Unless the system property com.sun.net.ssl.rsaPreMasterSecretFix
is set to true
, the TLS client sends the active negotiated version, but not the expected maximum version supported by the client.
For compatibility, this behavior is preserved for SSL version 3.0 and TLS version 1.0. However, for TLS version 1.1 or later, the implementation tightens checking the PreMasterSecret version numbers as required by RFC 5246. Clients always send the correct version number, and servers check the version number strictly. The system property, com.sun.net.ssl.rsaPreMasterSecretFix
, is not used in TLS 1.1 or later.
SunJCE
Provider
As described briefly in The SUN
Provider, US export regulations at the time restricted the type of cryptographic functionality that could be made available in the JDK. A separate API and reference implementation was developed that allowed applications to encrypt/decrypt data. The Java Cryptographic Extension (JCE) was released as a separate "Optional Package" (also briefly known as a "Standard Extension"), and was available for JDK 1.2.x and 1.3.x. During the development of JDK 1.4, regulations were relaxed enough that JCE (and SunJSSE) could be bundled as part of the JDK.
The following algorithms are available in the SunJCE
provider:
AlgorithmParameterGenerator
DiffieHellman AlgorithmParameters
AES
Cipher
See the Cipher table. KeyAgreement
DiffieHellman KeyFactory
DiffieHellman
KeyGenerator
AES
KeyPairGenerator
DiffieHellman
KeyStore
JCEKS
Mac
HmacMD5
SecretKeyFactory
DES
The following table lists cipher algorithms available in the SunJCE
provider.
Footnote 1 Though the standard doesn't specify or require the padding bytes to be random, the Java SE ISO10126Padding implementation pads with random bytes (until the last byte, which provides the length of padding, as specified).
Footnote 2 PBEWithMD5AndTripleDES is a proprietary algorithm that has not been standardized.
Keysize RestrictionsThe SunJCE
provider uses the following default keysizes (in bits) and enforces the following restrictions:
KeyGenerator
Algorithm Name Default Keysize Restrictions/Comments AES 128 Keysize must be equal to 128, 192, or 256. ARCFOUR (RC4) 128 Keysize must range between 40 and 1024 (inclusive). Blowfish 128 Keysize must be a multiple of 8, ranging from 32 to 448 (inclusive). DES 56 Keysize must be equal to 56. DESede (Triple DES) 168 Keysize must be equal to 112 or 168.A keysize of 112 will generate a Triple DES key with 2 intermediate keys, and a keysize of 168 will generate a Triple DES key with 3 intermediate keys.
Due to the "Meet-In-The-Middle" problem, even though 112 or 168 bits of key material are used, the effective keysize is 80 or 112 bits respectively.
HmacMD5 512 No keysize restriction. HmacSHA1 512 No keysize restriction. HmacSHA224 224 No keysize restriction. HmacSHA256 256 No keysize restriction. HmacSHA384 384 No keysize restriction. HmacSHA512 512 No keysize restriction. RC2 128 Keysize must range between 40 and 1024 (inclusive).Note: The various Password-Based Encryption (PBE) algorithms use various algorithms to generate key data, and ultimately depends on the targeted Cipher algorithm. For example, "PBEWithMD5AndDES" will always generate 56-bit keys.
KeyPairGenerator
Algorithm Name Default Keysize Restrictions/Comments Diffie-Hellman (DH) 2048 Keysize must be a multiple of 64, ranging from 512 to 2048 (inclusive).AlgorithmParameterGenerator
Alg. Name Default Keysize Restrictions/Comments Diffie-Hellman (DH) 2048 Keysize must be a multiple of 64, ranging from 512 to 2048 (inclusive). TheSunJGSS
Provider
The following algorithms are available in the SunJGSS
provider:
1.2.840.113554.1.2.2
Kerberos v5 1.3.6.1.5.5.2
SPNEGO The SunSASL
Provider
The following algorithms are available in the SunSASL
provider:
SaslClient
CRAM-MD5
SaslServer
CRAM-MD5
XMLDSig
Provider
The following algorithms are available in the XMLDSig
provider:
KeyInfoFactory
DOM TransformService
http://www.w3.org/TR/2001/REC-xml-c14n-20010315 - (CanonicalizationMethod.INCLUSIVE
)
CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS
)
CanonicalizationMethod.EXCLUSIVE
)
CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS
)
Transform.BASE64
)
Transform.ENVELOPED
)
Transform.XPATH
)
Transform.XPATH2
)
Transform.XSLT
)
XMLSignatureFactory
DOM The SunPCSC
Provider
The SunPCSC
provider enables applications to use the Java Smart Card I/O API to interact with the PC/SC Smart Card stack of the underlying operating system. On some operating systems, it may be necessary to enable and configure the PC/SC stack before it is usable. Consult your operating system documentation for details.
On Solaris and Linux platforms, SunPCSC
accesses the PC/SC stack via the libpcsclite.so
library. It looks for this library in the directories /usr/$LIBISA
and /usr/local/$LIBISA
, where $LIBISA
is expanded to lib
on 32-bit platforms, lib/64
on 64-bit Solaris platforms, and lib64
on 64-bit Linux platforms. The system property sun.security.smartcardio.library
may also be set to the full filename of an alternate libpcsclite.so
implementation. On Windows platforms, SunPCSC
always calls into winscard.dll
and no Java-level configuration is necessary or possible.
If PC/SC is available on the host platform, the SunPCSC
implementation can be obtained via TerminalFactory.getDefault()
and TerminalFactory.getInstance("PC/SC")
. If PC/SC is not available or not correctly configured, a getInstance()
call will fail with a NoSuchAlgorithmException
and getDefault()
will return a JRE built-in implementation that does not support any terminals.
The following algorithms are available in the SunPCSC
provider:
TerminalFactory
PC/SC The SunMSCAPI
Provider
The SunMSCAPI
provider enables applications to use the standard JCA/JCE APIs to access the native cryptographic libraries, certificates stores and key containers on the Microsoft Windows platform. The SunMSCAPI
provider itself does not contain cryptographic functionality, it is simply a conduit between the Java environment and the native cryptographic services on Windows.
The following algorithms are available in the SunMSCAPI
provider:
Cipher
RSA RSA/ECB/PKCS1Padding only KeyPairGenerator
RSA KeyStore
Windows-MY
The keystore type that identifies the native Microsoft Windows MY keystore. It contains the user's personal certificates and associated private keys.
Windows-ROOTThe keystore type that identifies the native Microsoft Windows ROOT keystore. It contains the certificates of Root certificate authorities and other self-signed trusted certificates.
SecureRandom
Windows-PRNG
The name of the native pseudo-random number generation (PRNG) algorithm.
Signature
MD5withRSA
The SunMSCAPI
provider uses the following default keysizes (in bits) and enforce the following restrictions:
KeyGenerator
Alg. Name Default Keysize Restrictions/Comments RSA 2048 Keysize ranges from 512 bits to 16,384 bits (depending on the underlying Microsoft Windows cryptographic service provider). TheSunEC
Provider
The SunEC
provider implements Elliptical Curve Cryptography (ECC). Compared to traditional cryptosystems such as RSA, ECC offers equivalent security with smaller key sizes, which results in faster computations, lower power consumption, and memory and bandwidth savings. Applications can use the standard JCA/JCE APIs to access ECC functionality without the dependency on external ECC libraries (through SunPKCS11
).
The following algorithms are available in the SunEC
provider:
Footnote 1 This algorithm won't be available from the SunEC provider through the JCA/JCE APIs if you delete the SunEC
provider's native library. See Effect of Removing SunEC Provider's Native Library.
The SunEC
provider uses a native library to provide some ECC functionality. If you don't want to use this native library, then delete the following files (depending on your operating system):
$JAVA_HOME/lib/libsunec.so
$JAVA_HOME/lib/libsunec.dylib
%JAVA_HOME%\bin\sunec.dll
If you delete the native library, then the algorithms with a footnote in the previous table won't be available from the SunEC
provider through the JCA/JCE APIs.
Note: Other installed providers (for example, SunPCKS11
) may still provide these algorithms.
Libraries and tools (for example, JSSE, XML Digital Signature, and keytool) that use these algorithms may have reduced functionality. For example, JSSE may no longer be able to generate EC keypairs, use EC-based peer certificates, or perform ECDH/ECDHE key agreements for SSL/TLS connections. Ciphersuites such as TLS_*_ECDSA and TLS_ECDHE_* may be unavailable. SSL/TLS connections can still use alternate algorithms to secure connections, such as RSA-/DSA-based certificates and key agreements based on DH/DHE (RFC 2631) or FFDHE (RFC 7919).
Even if the native library is removed, the rest of the algorithms (the algorithms without a footnote) are still available from the SunEC provider, as they are not implemented in the native library code.
Keysize RestrictionsThe SunEC
provider uses the following default keysizes (in bits) and enforces the following restrictions:
KeyPairGenerator
Alg. Name Default Keysize Restrictions/Comments EC 256 Keysize must range from 112 to 571 (inclusive). Supported Elliptic Curve NamesThe SunEC
provider includes implementations of various elliptic curves for use with the EC, Elliptic-Curve Diffie-Hellman (ECDH), and Elliptic Curve Digital Signature Algorithm (ECDSA) algorithms. Some of these curves have been implemented using modern formulas and techniques that are valuable for preventing side-channel attacks. The others are legacy curves that might be more vulnerable to attacks and should not be used. The tables below list the curves that fall into each of these categories.
In the following tables, the first column, Curve Name, lists the name that SunEC implements. The second column, Object Identifier, specifies the EC name's object identifier. The third column, Additional Names/Aliases, specifies any additional names or aliases for that curve. All strings that appear in one row refer to the same curve. For example, the strings secp256r1
, 1.2.840.10045.3.1.7
, NIST P-256
, and X9.62 prime256v1
refer to the same curve. You can use the curve names to create parameter specifications for EC parameter generation with the ECGenParameterSpec
class.
The following table lists the elliptic curves that are provided by the SunEC
provider and are implemented using modern formulas and techniques. These curves are recommended and should be preferred over the curves listed in the section Legacy Curves Retained for Compatibility.
It is recommended that you migrate to newer curves.
The following table lists elliptic curves that are provided by the SunEC
provider and are not implemented using modern formulas and techniques. These curves remain available for compatibility reasons to afford legacy systems time to migrate to newer curves. These implementations will be removed or replaced in a future version of the JDK.
OracleUcrypto
Provider
The Solaris-only security provider OracleUcrypto
leverages the Solaris Ucrypto library to offload and delegate cryptographic operations supported by the Oracle SPARC T4 based on-core cryptographic instructions. The OracleUcrypto
provider itself does not contain cryptographic functionality; it is simply a conduit between the Java environment and the Solaris Ucrypto library.
If the underlying Solaris Ucrypto library does not support a particular algorithm, then the OracleUcrypto
provider will not support it either. Consequently, at runtime, the supported algorithms consists of the intersection of those that the Solaris Ucrypto library supports and those that the OracleUcrypto
provider recognizes.
Note that the OracleUcrypto
provider is included only in Oracle's JDK. It is not part of OpenJDK.
The following algorithms are available in the OracleUcrypto
provider:
Cipher
AES
Signature
MD5withRSA
MessageDigest
MD5
The OracleUcrypto
provider does not specify any default keysizes or keysize restrictions; these are specified by the underlying Solaris Ucrypto library.
OracleUcrypto
Provider Configuration File
The OracleUcrypto
provider has a configuration file named ucrypto-solaris.cfg
that resides in the $JAVA_HOME/lib/security
directory. Modify this configuration file to specify which algorithms to disable by default. For example, the following configuration file disables AES with CFB128 mode by default:
# # Configuration file for the OracleUcrypto provider # disabledServices = { Cipher.AES/CFB128/PKCS5Padding Cipher.AES/CFB128/NoPadding }The Apple Provider
The Apple
provider implements a java.security.KeyStore
that provides access to the macOS Keychain.
The following algorithms are available in the Apple
provider:
KeyStore
KeychainStore
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4