pkix

Validating a certificate in java throws an exception - unable to find valid certificate path to requested target

╄→尐↘猪︶ㄣ 提交于 2019-11-27 19:56:09
I have a web app that requires a client to send it's certificate and the server has to validate the certificate(i.e see if the issuer is a valid issuer and present in the server's truststore). Here is the code : FileInputStream fin=new FileInputStream("C:/trustedca"); KeyStore anchors = KeyStore.getInstance("JKS","SUN"); anchors.load(fin, "server".toCharArray()); X509CertSelector target = new X509CertSelector(); FileInputStream fin1=new FileInputStream("C:/client.crt"); CertificateFactory cf=CertificateFactory.getInstance("X.509"); X509Certificate cert=null; while (fin1.available() > 0) {

Error in JavaMail : PKIX path building failed unable to find valid certification path to requested target

孤街浪徒 提交于 2019-11-27 13:37:05
问题 I am trying to build an email client app in android and right now i want to configure the javaMail part. i am trying to establish the connection with the imap server but something is wrong with my code.. here is my code: package mailpackage; import java.util.Properties; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.NoSuchProviderException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Store

Programmatically verify certificate chain using OpenSSL API

旧时模样 提交于 2019-11-27 12:46:25
This is very similar to other questions but the ones I've looked at either don't have an answer or don't quite ask the same question. I have a self-signed CA certificate, and two other certificates that are signed with that CA certificate. I'm fairly sure the certificates are correct, because 'openssl verify' works: $ openssl verify -CAfile ca.pem server.pem server.pem: OK (The above is from memory, I don't have them in front of me, so it may be slightly off). Now I want to verify the certificates programatically. I have a utility function with pseudocode below: int verify_cert(X509 *cert,

Validating a certificate in java throws an exception - unable to find valid certificate path to requested target

耗尽温柔 提交于 2019-11-26 22:52:21
问题 I have a web app that requires a client to send it's certificate and the server has to validate the certificate(i.e see if the issuer is a valid issuer and present in the server's truststore). Here is the code : FileInputStream fin=new FileInputStream("C:/trustedca"); KeyStore anchors = KeyStore.getInstance("JKS","SUN"); anchors.load(fin, "server".toCharArray()); X509CertSelector target = new X509CertSelector(); FileInputStream fin1=new FileInputStream("C:/client.crt"); CertificateFactory cf

Programmatically Create X509 Certificate using OpenSSL

一世执手 提交于 2019-11-26 19:25:47
I have a C/C++ application and I need to create a X509 pem certificate containing both a public and private key. The certificate can be self signed, or unsigned, doesn't matter. I want to do this inside an app, not from command line. What OpenSSL functions will do this for me? Any sample code is a bonus! Martin v. Löwis You'll need to familiarize yourself with the terminology and mechanisms first. An X.509 certificate , by definition, does not include a private key. Instead, it is a CA-signed version of the public key (along with any attributes the CA puts into the signature). The PEM format

Programmatically Create X509 Certificate using OpenSSL

蹲街弑〆低调 提交于 2019-11-26 06:58:07
问题 I have a C/C++ application and I need to create a X509 pem certificate containing both a public and private key. The certificate can be self signed, or unsigned, doesn\'t matter. I want to do this inside an app, not from command line. What OpenSSL functions will do this for me? Any sample code is a bonus! 回答1: You'll need to familiarize yourself with the terminology and mechanisms first. An X.509 certificate , by definition, does not include a private key. Instead, it is a CA-signed version

Invalid self signed SSL cert - “Subject Alternative Name Missing”

那年仲夏 提交于 2019-11-26 06:05:18
问题 Recently, Chrome has stopped working with my self signed SSL certs, and thinks they\'re insecure. When I look at the cert in the DevTools | Security tab, I can see that it says Subject Alternative Name Missing The certificate for this site does not contain a Subject Alternative Name extension containing a domain name or IP address. Certificate Error There are issues with the site\'s certificate chain (net::ERR_CERT_COMMON_NAME_INVALID). How can I fix this? 回答1: To fix this, you need to supply