OpenSSL:PEM例程:PEM_read_bio:无起始行:pem_lib.c:703:预期:

我需要文件的哈希名称以将其发布到Stunnel的CApath目录中。我在此目录中有一些证书,它们运行良好。另外,我有一个服务器sert和服务器密钥:


cert = c:\Program Files (x86)\stunnel\server_cert.pem 

key = c:\Program> Files (x86)\stunnel\private\server_key.pem

当我尝试计算新证书的哈希值时,出现错误:


/etc/pki/tls/misc/c_hash cert.pem


unable to load certificate 140603809879880:error:0906D06C:PEM

routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE

据我了解,我必须签署证书,但我不知道该怎么做。请提供解决方案。


PS:


讯息


unable to load certificate 140603809879880:error:0906D06C:PEM

routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE:

我为cert.pem制作c_hash时发布的信息这不是server_cert.pem,这是Root_CA,内容类似


-----BEGIN CERTIFICATE-----  

...6UXBNSDVg5rSx60=.. 


-----END CERTIFICATE-----

当我写


openssl x509 -noout -text -in cert.pem

在控制台面板中,我看到以下信息:


    Certificate:

    Data:

        Version: 3 (0x2)

        Serial Number: 1 (0x1)

    Signature Algorithm: sha1WithRSAEncryption

        Issuer: C=BE, ST=BB, L=BB, O=BANKSYS NV, OU=SCY, CN=TEST Root CA

        Validity

            Not Before: May 31 08:06:40 2005 GMT

            Not After : May 31 08:06:40 2020 GMT

        Subject: C=BE, ST=BB, L=BB, O=BB NV, OU=SCY, CN=TEST Root CA

        Subject Public Key Info:

            Public Key Algorithm: rsaEncryption

                Public-Key: (2048 bit)

                Modulus:

                    00:82:c8:58:1e:e5:7a:b2:63:a6:15:bd:f9:bb:1f:

............

                Exponent: 65537 (0x10001)

        X509v3 extensions:

            X509v3 Basic Constraints: critical

                CA:TRUE

            X509v3 Key Usage: critical

                Certificate Sign, CRL Sign

            X509v3 Subject Key Identifier:

                76:70:AB:92:9B:B1:26:CE:9E:93:D8:77:4F:78:0D:B8:D4:6C:DA:C6

    Signature Algorithm: sha1WithRSAEncryption

         2c:7e:bd:3f:da:48:a4:df:8d:7c:96:58:f7:87:bd:e7:16:24:

...............


智慧大石
浏览 3080回答 3
3回答

九州编程

我的情况有些不同。解决方案是从证书和私钥部分之外的所有内容中剥离.pem并反转它们出现的顺序。从pfx转换为pem文件后,证书如下所示:Bag AttributeslocalKeyID: ...issuer=...-----BEGIN CERTIFICATE-----...-----END CERTIFICATE-----Bag Attributesmore garbage...-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----更正文件后,它只是:-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY----------BEGIN CERTIFICATE-----...-----END CERTIFICATE-----
打开App,查看更多内容
随时随地看视频慕课网APP