Could not parse certificate: java.io.IOException: Empty input X509Certificate

前端 未结 3 832
渐次进展
渐次进展 2021-02-02 11:26

I am getting the error given below when parsing the signature. Anybody has idea why the error is showing?

Note that:

  1. Using the same certificate I signe

相关标签:
3条回答
  • 2021-02-02 11:54

    It's been a while since this post but I came here looking for this issue. In my case, the key was that the certificate was in a Base64-String.getBytes[] instead of a DECODED-Base64-String.getBytes[].

    Hope it helps someone :)

    0 讨论(0)
  • 2021-02-02 12:12

    After going through so many blogs nothing helped as such. Finally we confirmed the way client is doing his encryption and used the same jars used for our verification. I am not sure if this is correct answer or not but may help somebody who is trying hard to resolve this issue. It may give you some clue if not able to resolve above error after going through many sites. So try to use same jars which used for client encryption and get the compatible private key for your public key and add to pk12 file. Convert pk12 to jks which you can use for encryption and verification too which resolved our issue. Some process too

    #**Create PKCS12 keystore from private key and public certificate.**
    openssl pkcs12 -export -name myservercert -in selfsigned.crt -inkey server.key -out keystore.p12
    #**Convert PKCS12 keystore into a JKS keystore**
    keytool -importkeystore -destkeystore mykeystore.jks -srckeystore keystore.p12 -srcstoretype pkcs12 -alias myservercer
    

    Good luck guys.

    0 讨论(0)
  • 2021-02-02 12:20

    Error can be as simple as not having the BEGIN and END tags in your certificate set.

    -----BEGIN CERTIFICATE-----
    your cert data here
    -----END CERTIFICATE-----
    
    0 讨论(0)
提交回复
热议问题