本文介绍了如何检查“ Java密码学扩展”?已安装?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个需要安装 Java密码学扩展(JCE)的项目中,我认为我已经完成了。我按照这里的说明进行操作:

I'm working on a project where I need to install the "Java Cryptography Extension" (JCE), which I think I've done. I followed the instructions here:

是否有任何方法可以验证我是否已正确安装它-我正在运行的一些测试表明它没有正确安装。

Is there any way to verify that I've installed it correctly - some of the tests that I am running indicate that it's not.

结果是,我的问题是以下重复项,并且可接受的解决方案非常有效:

Turns out my question is a duplicate of the following, and the accepted solution works perfectly:

推荐答案

这是一种更现代的Java实现



Here is a more modern Java implementation

import java.security.Provider;
import java.security.Security;
import java.util.Arrays;

public class ShowCryptoProviders
{
    private static final String EOL = System.getProperty("line.separator");

    public static void main(final String[] args)
    {
        final Provider[] providers = Security.getProviders();
        final Boolean verbose = Arrays.asList(args).contains("-v");
        for (final Provider p : providers)
        {
            System.out.format("%s %s%s", p.getName(), p.getVersion(), EOL);
            for (final Object o : p.keySet())
            {
                if (verbose)
                {
                    System.out.format("\t%s : %s%s", o, p.getProperty((String)o), EOL);
                }
            }
        }
    }
}

我无法想象这里的某些内容无法告诉您您需要了解的内容。如果不只是通过检查无限强度 .html#getMaxAllowedKeyLength%28java.lang.String%29 rel = noreferrer> Cypher.getMaxAllowedKeyLength() ,它应该返回一个非常大的数字128。

I can't imagine that something in here can't tell you what you need to know. If it doesn't just test for "Unlimited Strength" by checking the Cypher.getMaxAllowedKeyLength() it should return a very large number well above 128.

使用 -v (verbose)获得以下输出。

Use -v ( verbose ) to get the following output.

SunJCE 1.7
    Cipher.Blowfish SupportedKeyFormats : RAW
        AlgorithmParameters.DESede : com.sun.crypto.provider.DESedeParameters
        AlgorithmParameters.DES : com.sun.crypto.provider.DESParameters
        Cipher.DES SupportedPaddings : NOPADDING|PKCS5PADDING|ISO10126PADDING
        AlgorithmParameters.Blowfish : com.sun.crypto.provider.BlowfishParameters
        Cipher.DESedeWrap SupportedKeyFormats : RAW
        Alg.Alias.KeyAgreement.1.2.840.113549.1.3.1 : DiffieHellman
        AlgorithmParameterGenerator.DiffieHellman : com.sun.crypto.provider.DHParameterGenerator
        Cipher.RSA SupportedPaddings : NOPADDING|PKCS1PADDING|OAEPWITHMD5ANDMGF1PADDING|OAEPWITHSHA1ANDMGF1PADDING|OAEPWITHSHA-1ANDMGF1PADDING|OAEPWITHSHA-256ANDMGF1PADDING|OAEPWITHSHA-384ANDMGF1PADDING|OAEPWITHSHA-512ANDMGF1PADDING
        Alg.Alias.Cipher.TripleDES : DESede
        Cipher.ARCFOUR SupportedModes : ECB
        Mac.SslMacSHA1 SupportedKeyFormats : RAW
        KeyGenerator.DES : com.sun.crypto.provider.DESKeyGenerator
        Provider.id version : 1.7
        KeyGenerator.DESede : com.sun.crypto.provider.DESedeKeyGenerator
        Alg.Alias.SecretKeyFactory.PBE : PBEWithMD5AndDES
        Alg.Alias.KeyFactory.1.2.840.113549.1.3.1 : DiffieHellman
        Mac.HmacSHA1 : com.sun.crypto.provider.HmacSHA1
        Cipher.PBEWithMD5AndDES : com.sun.crypto.provider.PBEWithMD5AndDESCipher
        Cipher.AES SupportedModes : ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64|CFB72|CFB80|CFB88|CFB96|CFB104|CFB112|CFB120|CFB128|OFB72|OFB80|OFB88|OFB96|OFB104|OFB112|OFB120|OFB128
        Cipher.AESWrap SupportedModes : ECB
        SecretKeyFactory.DESede : com.sun.crypto.provider.DESedeKeyFactory
        KeyGenerator.SunTlsKeyMaterial : com.sun.crypto.provider.TlsKeyMaterialGenerator
        AlgorithmParameters.OAEP : com.sun.crypto.provider.OAEPParameters
        Cipher.AES SupportedKeyFormats : RAW
        AlgorithmParameters.RC2 : com.sun.crypto.provider.RC2Parameters
        AlgorithmParameters.PBE : com.sun.crypto.provider.PBEParameters
        Alg.Alias.KeyPairGenerator.DH : DiffieHellman
        Alg.Alias.KeyAgreement.OID.1.2.840.113549.1.3.1 : DiffieHellman
        Cipher.AES : com.sun.crypto.provider.AESCipher
        KeyGenerator.RC2 : com.sun.crypto.provider.KeyGeneratorCore$RC2KeyGenerator
        Mac.HmacSHA512 : com.sun.crypto.provider.HmacCore$HmacSHA512
        Provider.id info : SunJCE Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, Diffie-Hellman, HMAC)
        Cipher.AES SupportedPaddings : NOPADDING|PKCS5PADDING|ISO10126PADDING
        Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.1.12.1.6 : PBEWithSHA1AndRC2_40
        Cipher.Blowfish SupportedPaddings : NOPADDING|PKCS5PADDING|ISO10126PADDING
        Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.1.12.1.3 : PBEWithSHA1AndDESede
        Alg.Alias.KeyGenerator.SunTls12KeyMaterial : SunTlsKeyMaterial
        KeyStore.JCEKS : com.sun.crypto.provider.JceKeyStore
        Cipher.Blowfish SupportedModes : ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64
        Alg.Alias.SecretKeyFactory.1.2.840.113549.1.5.12 : PBKDF2WithHmacSHA1
        Mac.HmacSHA384 SupportedKeyFormats : RAW
        Cipher.DESedeWrap : com.sun.crypto.provider.DESedeWrapCipher
        Cipher.ARCFOUR SupportedPaddings : NOPADDING
        Alg.Alias.KeyPairGenerator.1.2.840.113549.1.3.1 : DiffieHellman
        Cipher.PBEWithMD5AndTripleDES : com.sun.crypto.provider.PBEWithMD5AndTripleDESCipher
        Alg.Alias.Cipher.1.2.840.113549.1.12.1.6 : PBEWithSHA1AndRC2_40
        Alg.Alias.Cipher.1.2.840.113549.1.12.1.3 : PBEWithSHA1AndDESede
        Mac.HmacSHA256 SupportedKeyFormats : RAW
        Alg.Alias.KeyGenerator.SunTls12RsaPremasterSecret : SunTlsRsaPremasterSecret
        Alg.Alias.AlgorithmParameterGenerator.1.2.840.113549.1.3.1 : DiffieHellman
        Cipher.PBEWithSHA1AndDESede : com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndDESede
        Alg.Alias.KeyGenerator.SunTls12MasterSecret : SunTlsMasterSecret
        SecretKeyFactory.PBEWithMD5AndDES : com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndDES
        KeyPairGenerator.DiffieHellman : com.sun.crypto.provider.DHKeyPairGenerator
        Cipher.RC2 SupportedModes : ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64
        Alg.Alias.AlgorithmParameters.Rijndael : AES
        KeyAgreement.DiffieHellman SupportedKeyClasses : javax.crypto.interfaces.DHPublicKey|javax.crypto.interfaces.DHPrivateKey
        Mac.HmacMD5 SupportedKeyFormats : RAW
        KeyGenerator.SunTlsRsaPremasterSecret : com.sun.crypto.provider.TlsRsaPremasterSecretGenerator
        Cipher.AESWrap SupportedKeyFormats : RAW
        SecretKeyFactory.DES : com.sun.crypto.provider.DESKeyFactory
        Cipher.AESWrap SupportedPaddings : NOPADDING
        Provider.id name : SunJCE
        KeyGenerator.HmacSHA512 : com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG
        Mac.HmacSHA256 : com.sun.crypto.provider.HmacCore$HmacSHA256
        Cipher.ARCFOUR SupportedKeyFormats : RAW
        Cipher.DES SupportedModes : ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64
        Cipher.RSA SupportedKeyClasses : java.security.interfaces.RSAPublicKey|java.security.interfaces.RSAPrivateKey
        SecretKeyFactory.PBEWithMD5AndTripleDES : com.sun.crypto.provider.PBEKeyFactory$PBEWithMD5AndTripleDES
        Cipher.PBEWithSHA1AndRC2_40 : com.sun.crypto.provider.PKCS12PBECipherCore$PBEWithSHA1AndRC2_40
        AlgorithmParameters.DiffieHellman : com.sun.crypto.provider.DHParameters
        Mac.HmacMD5 : com.sun.crypto.provider.HmacMD5
        Cipher.RSA : com.sun.crypto.provider.RSACipher
        Mac.SslMacMD5 : com.sun.crypto.provider.SslMacCore$SslMacMD5
        Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.1.5.3 : PBEWithMD5AndDES
        Cipher.DESede SupportedPaddings : NOPADDING|PKCS5PADDING|ISO10126PADDING
        Alg.Alias.AlgorithmParameterGenerator.OID.1.2.840.113549.1.3.1 : DiffieHellman
        Cipher.DESede : com.sun.crypto.provider.DESedeCipher
        Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.1.3.1 : DiffieHellman
        Alg.Alias.AlgorithmParameters.1.2.840.113549.1.5.3 : PBEWithMD5AndDES
        Mac.HmacSHA512 SupportedKeyFormats : RAW
        Mac.HmacPBESHA1 SupportedKeyFormats : RAW
        Alg.Alias.AlgorithmParameterGenerator.DH : DiffieHellman
        Cipher.DESedeWrap SupportedPaddings : NOPADDING
        Alg.Alias.SecretKeyFactory.OID.1.2.840.113549.1.5.12 : PBKDF2WithHmacSHA1
        Alg.Alias.AlgorithmParameters.1.2.840.113549.1.3.1 : DiffieHellman
        Mac.HmacPBESHA1 : com.sun.crypto.provider.HmacPKCS12PBESHA1
        Cipher.DES SupportedKeyFormats : RAW
        AlgorithmParameters.PBEWithMD5AndTripleDES : com.sun.crypto.provider.PBEParameters
        Cipher.DESedeWrap SupportedModes : CBC
        Alg.Alias.KeyFactory.OID.1.2.840.113549.1.3.1 : DiffieHellman
        Alg.Alias.Cipher.OID.1.2.840.113549.1.5.3 : PBEWithMD5AndDES
        AlgorithmParameters.AES : com.sun.crypto.provider.AESParameters
        Alg.Alias.AlgorithmParameters.TripleDES : DESede
        Alg.Alias.SecretKeyFactory.TripleDES : DESede
        KeyGenerator.HmacSHA256 : com.sun.crypto.provider.KeyGeneratorCore$HmacSHA256KG
        Alg.Alias.KeyGenerator.TripleDES : DESede
        Alg.Alias.AlgorithmParameters.DH : DiffieHellman
        KeyGenerator.AES : com.sun.crypto.provider.AESKeyGenerator
        Cipher.RC2 SupportedPaddings : NOPADDING|PKCS5PADDING|ISO10126PADDING
        Alg.Alias.Cipher.RC4 : ARCFOUR
        Alg.Alias.KeyPairGenerator.OID.1.2.840.113549.1.3.1 : DiffieHellman
        Mac.HmacSHA384 : com.sun.crypto.provider.HmacCore$HmacSHA384
        SecretKeyFactory.PBKDF2WithHmacSHA1 : com.sun.crypto.provider.PBKDF2HmacSHA1Factory
        Provider.id className : com.sun.crypto.provider.SunJCE
        Cipher.DES : com.sun.crypto.provider.DESCipher
        Cipher.Blowfish : com.sun.crypto.provider.BlowfishCipher
        KeyGenerator.SunTlsMasterSecret : com.sun.crypto.provider.TlsMasterSecretGenerator
        KeyGenerator.HmacSHA1 : com.sun.crypto.provider.HmacSHA1KeyGenerator
        Alg.Alias.SecretKeyFactory.1.2.840.113549.1.5.3 : PBEWithMD5AndDES
        KeyGenerator.SunTlsPrf : com.sun.crypto.provider.TlsPrfGenerator$V10
        SecretKeyFactory.PBEWithSHA1AndDESede : com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndDESede
        KeyGenerator.ARCFOUR : com.sun.crypto.provider.KeyGeneratorCore$ARCFOURKeyGenerator
        Alg.Alias.KeyAgreement.DH : DiffieHellman
        Alg.Alias.KeyGenerator.Rijndael : AES
        AlgorithmParameters.PBEWithSHA1AndDESede : com.sun.crypto.provider.PBEParameters
        Alg.Alias.KeyGenerator.RC4 : ARCFOUR
        Alg.Alias.Cipher.OID.1.2.840.113549.1.12.1.6 : PBEWithSHA1AndRC2_40
        Alg.Alias.Cipher.OID.1.2.840.113549.1.12.1.3 : PBEWithSHA1AndDESede
        Mac.SslMacMD5 SupportedKeyFormats : RAW
        Mac.HmacSHA1 SupportedKeyFormats : RAW
        Cipher.DESede SupportedKeyFormats : RAW
        Cipher.RC2 : com.sun.crypto.provider.RC2Cipher
        KeyGenerator.SunTls12Prf : com.sun.crypto.provider.TlsPrfGenerator$V12
        SecretKeyFactory.PBEWithSHA1AndRC2_40 : com.sun.crypto.provider.PBEKeyFactory$PBEWithSHA1AndRC2_40
        KeyGenerator.HmacMD5 : com.sun.crypto.provider.HmacMD5KeyGenerator
        AlgorithmParameters.PBEWithSHA1AndRC2_40 : com.sun.crypto.provider.PBEParameters
        KeyGenerator.HmacSHA384 : com.sun.crypto.provider.KeyGeneratorCore$HmacSHA384KG
        Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.6 : PBEWithSHA1AndRC2_40
        KeyFactory.DiffieHellman : com.sun.crypto.provider.DHKeyFactory
        Alg.Alias.AlgorithmParameters.1.2.840.113549.1.12.1.3 : PBEWithSHA1AndDESede
        AlgorithmParameters.PBEWithMD5AndDES : com.sun.crypto.provider.PBEParameters
        Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.6 : PBEWithSHA1AndRC2_40
        Alg.Alias.SecretKeyFactory.1.2.840.113549.1.12.1.3 : PBEWithSHA1AndDESede
        Cipher.AESWrap : com.sun.crypto.provider.AESWrapCipher
        Alg.Alias.SecretKeyFactory.OID.1.2.840.113549.1.5.3 : PBEWithMD5AndDES
        Alg.Alias.Cipher.Rijndael : AES
        Cipher.RSA SupportedModes : ECB
        Cipher.DESede SupportedModes : ECB|CBC|PCBC|CTR|CTS|CFB|OFB|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64|OFB8|OFB16|OFB24|OFB32|OFB40|OFB48|OFB56|OFB64
        Alg.Alias.SecretKeyFactory.OID.1.2.840.113549.1.12.1.6 : PBEWithSHA1AndRC2_40
        Alg.Alias.SecretKeyFactory.OID.1.2.840.113549.1.12.1.3 : PBEWithSHA1AndDESede
        Cipher.ARCFOUR : com.sun.crypto.provider.ARCFOURCipher
        Alg.Alias.Cipher.1.2.840.113549.1.5.3 : PBEWithMD5AndDES
        Mac.SslMacSHA1 : com.sun.crypto.provider.SslMacCore$SslMacSHA1
        KeyAgreement.DiffieHellman : com.sun.crypto.provider.DHKeyAgreement
        Cipher.RC2 SupportedKeyFormats : RAW
        Alg.Alias.KeyFactory.DH : DiffieHellman
        KeyGenerator.Blowfish : com.sun.crypto.provider.BlowfishKeyGenerator

我相信检查特定的密钥生成器,例如 KeyGenerator.HmacSHA512:com.sun.crypto .provider.KeyGeneratorCore $ HmacSHA512KG 可以告诉您相同的内容,而不必依赖键长查询。

I believe that checking for a specific keygenerator such as KeyGenerator.HmacSHA512 : com.sun.crypto.provider.KeyGeneratorCore$HmacSHA512KG may tell you the same thing without having to rely on the key length query.

这篇关于如何检查“ Java密码学扩展”?已安装?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 12:02