简体   繁体   English

找不到支持的密码套件的提供程序错误

[英]Cannot find provider error for the supported cipher suite

"TLS_RSA_WITH_AES_128_CBC_SHA256" cipher suite is supported by java 8 default providers. java 8默认提供程序支持“TLS_RSA_WITH_AES_128_CBC_SHA256”密码套件。 Ref - https://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html#SunJSSEProvider . 参考 - https://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html#SunJSSEProvider

Also I have following program to verify that. 我也有以下程序来验证。 But when I try to get the cipher for the same algorithm it gives error. 但是当我试图获得相同算法的密码时,它会产生错误。

import java.security.NoSuchAlgorithmException;

import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;

public class CipherSuitesInfoGenerator {

  public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchPaddingException {

    SSLContext context = SSLContext.getDefault();
    SSLSocketFactory sf = context.getSocketFactory();
    String[] cipherSuites = sf.getSupportedCipherSuites();

    String cipherName = "TLS_RSA_WITH_AES_128_CBC_SHA256";

    for (String s : cipherSuites) {
      if (s.equals(cipherName)) {
        System.out.println(cipherName + " is supported");

        try {
          Cipher cipher = Cipher.getInstance(cipherName);
        } catch (Exception e) {
          System.out.println(e.getMessage());
        }

        break;
      }

    }
  }
}

The output is: 输出是:

TLS_RSA_WITH_AES_128_CBC_SHA256 is supported
Cannot find any provider supporting TLS_RSA_WITH_AES_128_CBC_SHA256

A ciphersuite is something that is used internally in a JSSE provider, it defines the primitives used within the TLS protocol. 密码套件是在JSSE提供程序内部使用的东西,它定义了TLS协议中使用的原语。 It's not a Cipher , a Cipher instance in Java represents one primitive used for encryption/decryption such as AES or RSA. 它不是Cipher ,Java中的Cipher实例代表用于加密/解密的一个原语,如AES或RSA。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM