x509certificate

How to extract CN from X509Certificate in Java?

左心房为你撑大大i 提交于 2019-11-26 04:18:57
问题 I am using a SslServerSocket and client certificates and want to extract the CN from the SubjectDN from the client\'s X509Certificate . At the moment I call cert.getSubjectX500Principal().getName() but this of course gives me the total formatted DN of the client. For some reason I am just interested in the CN=theclient part of the DN. Is there a way to extract this part of the DN without parsing the String myself? 回答1: Here's some code for the new non-deprecated BouncyCastle API. You'll need

Importing the private-key/public-certificate pair in the Java KeyStore [duplicate]

寵の児 提交于 2019-11-26 03:47:25
问题 This question already has answers here : How to import an existing X.509 certificate and private key in Java keystore to use in SSL? (15 answers) Closed 5 years ago . I used the following steps to create a new Java keystore with a pair of private/public key to be used by a Java (internal) server with TLS. Please notice that the certificate is selfsigned: 1) Generate key with AES256 openssl genrsa -aes256 -out server.key 1024 2) Generate cert request for CA openssl req -x509 -sha256 -new -key

curl: (60) SSL certificate : unable to get local issuer certificate

人盡茶涼 提交于 2019-11-26 01:24:31
问题 root@sclrdev:/home/sclr/certs/FreshCerts# curl --ftp-ssl --verbose ftp://{abc}/ -u trup:trup --cacert /etc/ssl/certs/ca-certificates.crt * About to connect() to {abc} port 21 (#0) * Trying {abc}... * Connected to {abc} ({abc}) port 21 (#0) < 220-Cerberus FTP Server - Home Edition < 220-This is the UNLICENSED Home Edition and may be used for home, personal use only < 220-Welcome to Cerberus FTP Server < 220 Created by Cerberus, LLC > AUTH SSL < 234 Authentication method accepted * successfully

Httplistener with HTTPS support

泄露秘密 提交于 2019-11-26 00:46:25
问题 There seems to be a lot of confusing, sometimes conflicting, information with regards to making a .NET HTTPListener HTTPS capable. My understanding is as follows: One\'s C# code needs an https prefix (for example, https://*:8443 ) in order for the listener to understand that it needs to service SSL requests at this port. The actual SSL handshake happens under the covers and is handled by http.sys (buried somewhere on the Windows machine). The C# code doesn\'t have to explicitly manage the SSL

How to create a self-signed certificate with OpenSSL

烂漫一生 提交于 2019-11-25 23:56:23
问题 I\'m adding HTTPS support to an embedded Linux device. I have tried to generate a self-signed certificate with these steps: openssl req -new > cert.csr openssl rsa -in privkey.pem -out key.pem openssl x509 -in cert.csr -out cert.pem -req -signkey key.pem -days 1001 cat key.pem>>cert.pem This works, but I get some errors with, for example, Google Chrome: This is probably not the site you are looking for! The site\'s security certificate is not trusted! Am I missing something? Is this the