search

Home  >  Q&A  >  body text

node.js - Openssl生成证书后,在nodejs中不管用,报“ 'CERT_NOT_YET_VALID'”错误。


分别生成了这些证书;


然后在server.js如图配置;


在客户端client.js这样配置;
server启动,用client访问,但是报这样的错误,现在感觉可能是生成证书有问题,求各位帮忙如果正确生成证书
证书的环境是:openssl,CentOS。

这是火狐上的证书:

证书的配置:

ca证书:
-----BEGIN CERTIFICATE-----
MIICPzCCAagCCQDfQgbZ05u7HzANBgkqhkiG9w0BAQUFADBkMQswCQYDVQQGEwJD
TjEQMA4GA1UECAwHVGlhbkppbjEQMA4GA1UEBwwHVGlhbkppbjELMAkGA1UECgwC
TEQxCzAJBgNVBAsMAklUMRcwFQYDVQQDDA5sb2NhbGhvc3Q6MzAwMDAeFw0xNTEx
MzAxNTE1MDdaFw0xNTEyMzAxNTE1MDdaMGQxCzAJBgNVBAYTAkNOMRAwDgYDVQQI
DAdUaWFuSmluMRAwDgYDVQQHDAdUaWFuSmluMQswCQYDVQQKDAJMRDELMAkGA1UE
CwwCSVQxFzAVBgNVBAMMDmxvY2FsaG9zdDozMDAwMIGfMA0GCSqGSIb3DQEBAQUA
A4GNADCBiQKBgQDPIZTz/rzrhuE4ae+kh2Mym2u7coXHRCf2u6O3M+F2CB4gxDgg
vywoVBpkYQ+oudngyzg7Boa/yVp8ZiIv3I7y6otA+SiocxyxqguUk6lGQyWohguB
Tgl2d30kYqmJjZfVSwAn2Re0reMMFjvxTProZuC6fjlvvp9qxlr0IOMDIQIDAQAB
MA0GCSqGSIb3DQEBBQUAA4GBAEEP7nO3N1GGUCREcIa/VNOGM9YNRaLzRPteWT5W
Q7VztycEA/LMXzD2GajUmO35Tri6wmcTNlID7NRQFr9ln2iceCWfFD02ffo+v+Xn
rAbpZW1y5QMKG8MHhRzjkmVdLJ/JCrqX3UDqKudk8Hr5tc6/D43QGWONaxh4r9S7
zaO9
-----END CERTIFICATE-----

server证书:

-----BEGIN CERTIFICATE-----
MIICPzCCAagCCQDEIzg9MlH5dzAN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YDVQQHDAdUaWFuSmluMQswCQYDVQQKDAJMRDELMAkGA1UE
CwwCSVQxFzAVBgNVBAMMDmxvY2FsaG9zdDozMDAwMIGfMA0GCSqGSIb3DQEBAQUA
A4GNADCBiQKBgQDpo6GgDIKSU0/0qxaa6k4p8YRkhIfcmy/GAdrnRJSc2DHZFhmt
IrBGfDOgRC855EU+7koCGmVGeIatCUXxnRjGL+dp7pz2ZfDpyzeW4RhFDpDhwdFl
yqOSqpdkKHcJCOFyJnC9168WCqLRBMwOYcEeYdIteMNMEqWTL45lRJblQQIDAQAB
MA0GCSqGSIb3DQEBBQUAA4GBAH2baqfa6YslXLnLjA+UeFSmUvmau5eU9/oSmzeD
CTTyYbo9jbt55EW1Y7OBIABdhaZ8Y3gkqBdBFLzJ97vZV/6N22w7D9+B3IM1xVPZ
nW6ox3VZ3lfmcLAlqJeIWF1sJYTWIIquXkJZWT3wGcFHEZ2INqy/krpJ+Siap+/s
C3dB
-----END CERTIFICATE-----

PHPzPHPz2783 days ago718

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 13:09:21

    Post the certificate and see if it will take effect in the future? Or is your client on a system whose time is in the past? When you generated the certificate, was the system time correct? date Post the output to see?

    reply
    0
  • Cancelreply