Certificates does not conform to algorithm constraints

心已赠人 2022-06-11 06:54 187阅读 0赞

遇见问题

  1. 在爬取北京移动网厅时,遇见问题:
  2. SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
  3. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
  4. javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Certificates does not conform to algorithm constraints
  5. at sun.security.ssl.Alerts.getSSLException(Unknown Source)
  6. at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
  7. at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
  8. at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
  9. at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
  10. at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
  11. at sun.security.ssl.Handshaker.processLoop(Unknown Source)
  12. at sun.security.ssl.Handshaker.process_record(Unknown Source)
  13. at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
  14. at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
  15. at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
  16. at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
  17. at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source)
  18. at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
  19. at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(Unknown Source)
  20. at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(Unknown Source)
  21. at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(Unknown Source)
  22. at com.geotmt.base.common.HttpsUtil2.post(HttpsUtil2.java:102)
  23. at com.geotmt.base.common.HttpsUtil2.main(HttpsUtil2.java:124)
  24. Caused by: java.security.cert.CertificateException: Certificates does not conform to algorithm constraints
  25. at sun.security.ssl.AbstractTrustManagerWrapper.checkAlgorithmConstraints(Unknown Source)
  26. at sun.security.ssl.AbstractTrustManagerWrapper.checkAdditionalTrust(Unknown Source)
  27. at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(Unknown Source)
  28. ... 15 more

解决办法:

  1. 在网上百度一下,说是jdk6以后对于jdk.certpath.disabledAlgorithms 有加强了限制。该配置路径在jre\\lib\\security\\java.security中,改造是将jdk.certpath.disabledAlgorithms 后面的配置删除掉。
  2. 但是对于该jdk配置,本人因能力有限,不敢这么来。
  3. 而是否又会有很么影响,还在探索中。。。。
  4. # Algorithm restrictions for certification path (CertPath) processing
  5. #
  6. # In some environments, certain algorithms or key lengths may be undesirable
  7. # for certification path building and validation. For example, "MD2" is
  8. # generally no longer considered to be a secure hash algorithm. This section
  9. # describes the mechanism for disabling algorithms based on algorithm name
  10. # and/or key length. This includes algorithms used in certificates, as well
  11. # as revocation information such as CRLs and signed OCSP Responses.
  12. #
  13. # The syntax of the disabled algorithm string is described as this Java
  14. # BNF-style:
  15. # DisabledAlgorithms:
  16. # " DisabledAlgorithm { , DisabledAlgorithm } "
  17. #
  18. # DisabledAlgorithm:
  19. # AlgorithmName [Constraint]
  20. #
  21. # AlgorithmName:
  22. # (see below)
  23. #
  24. # Constraint:
  25. # KeySizeConstraint
  26. #
  27. # KeySizeConstraint:
  28. # keySize Operator DecimalInteger
  29. #
  30. # Operator:
  31. # <= | < | == | != | >= | >
  32. #
  33. # DecimalInteger:
  34. # DecimalDigits
  35. #
  36. # DecimalDigits:
  37. # DecimalDigit {DecimalDigit}
  38. #
  39. # DecimalDigit: one of
  40. # 1 2 3 4 5 6 7 8 9 0
  41. #
  42. # The "AlgorithmName" is the standard algorithm name of the disabled
  43. # algorithm. See "Java Cryptography Architecture Standard Algorithm Name
  44. # Documentation" for information about Standard Algorithm Names. Matching
  45. # is performed using a case-insensitive sub-element matching rule. (For
  46. # example, in "SHA1withECDSA" the sub-elements are "SHA1" for hashing and
  47. # "ECDSA" for signatures.) If the assertion "AlgorithmName" is a
  48. # sub-element of the certificate algorithm name, the algorithm will be
  49. # rejected during certification path building and validation. For example,
  50. # the assertion algorithm name "DSA" will disable all certificate algorithms
  51. # that rely on DSA, such as NONEwithDSA, SHA1withDSA. However, the assertion
  52. # will not disable algorithms related to "ECDSA".
  53. #
  54. # A "Constraint" provides further guidance for the algorithm being specified.
  55. # The "KeySizeConstraint" requires a key of a valid size range if the
  56. # "AlgorithmName" is of a key algorithm. The "DecimalInteger" indicates the
  57. # key size specified in number of bits. For example, "RSA keySize <= 1024"
  58. # indicates that any RSA key with key size less than or equal to 1024 bits
  59. # should be disabled, and "RSA keySize < 1024, RSA keySize > 2048" indicates
  60. # that any RSA key with key size less than 1024 or greater than 2048 should
  61. # be disabled. Note that the "KeySizeConstraint" only makes sense to key
  62. # algorithms.
  63. #
  64. # Note: This property is currently used by Oracle's PKIX implementation. It
  65. # is not guaranteed to be examined and used by other implementations.
  66. #
  67. # Example:
  68. # jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048
  69. #
  70. #
  71. jdk.certpath.disabledAlgorithms=

发表评论

表情:
评论列表 (有 0 条评论,187人围观)

还没有评论,来说两句吧...

相关阅读