x509

How to convert .crt to .pem [duplicate]

我只是一个虾纸丫 提交于 2019-11-26 16:55:28
Possible Duplicate: How to get .pem file from .key and .crt files? How can I convert .crt to .pem? MrEyes You can do this conversion with the OpenSSL library http://www.openssl.org/ Windows binaries can be found here: http://www.slproweb.com/products/Win32OpenSSL.html Once you have the library installed, the command you need to issue is: openssl x509 -in mycert.crt -out mycert.pem -outform PEM NeilG I found the OpenSSL answer given above didn't work for me, but the following did, working with a CRT file sourced from windows. openssl x509 -inform DER -in yourdownloaded.crt -out outcert.pem

SecCertificateRef: How to get the certificate information?

混江龙づ霸主 提交于 2019-11-26 15:17:10
问题 I have a certificate (SecCertificateRef), I can check if it's valid and I can extract a "summary" using SecCertificateCopySubjectSummary. What is the "summary" exactly? I don't understand the term "A string that contains a human-readable summary of the contents of the certificate." in the Apple documentation. I think, they mean the "CN" in the certificate, correct? Is there any method to get the clear X509-information out of SecCertificateRef? Does a cast to a keychain-object help? I want to

How to extract CN from X509Certificate in Java?

别说谁变了你拦得住时间么 提交于 2019-11-26 15:12:28
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? gtrak Here's some code for the new non-deprecated BouncyCastle API. You'll need both bcmail and bcprov distributions. X509Certificate cert = ...; X500Name x500name = new

How to read .pem file to get private and public key

给你一囗甜甜゛ 提交于 2019-11-26 14:10:59
I am writing a small piece of code which reads public and private key stored in .pem file. I am using the following commands to generate the keys. Below command to generate pair of key. $openssl genrsa -out mykey.pem 2048 This command to generate the private key $openssl pkcs8 -topk8 -inform PEM -outform PEM -in mykey.pem \ -out private_key.pem -nocrypt and this command to get the public key. $ openssl rsa -in mykey.pem -pubout -outform DER -out public_key.der I have written two methods which reads the private key and public key respectively. public PrivateKey getPemPrivateKey(String filename,

Self signed X509 Certificate with Bouncy Castle in Java

允我心安 提交于 2019-11-26 14:03:00
问题 I need to create a self signed X509 Certificate with Bouncy Castle in Java, but every class I try to include is deprecated. How can I solve this? Is there some other class to include? Thanks 回答1: Using Bouncycastle latest version - 1.55 Update to the answer by @Bewusstsein. The bouncycastle classes are deprecated in the latest version as of this answer (5/11/2017). If you are using the latest version (1.55) or relatively latest version: public static Certificate selfSign(KeyPair keyPair,

Extract public/private key from PKCS12 file for later use in SSH-PK-Authentication

邮差的信 提交于 2019-11-26 12:15:36
问题 I want to extract the public and private key from my PKCS#12 file for later use in SSH-Public-Key-Authentication. Right now, I\'m generating keys via ssh-keygen which I put into .ssh/authorized_key , respective somewhere on the client-side. In future, I want to use the keys from a PKCS#12 container, so I\'ve to extract the public-key first from PKCS#12 and then put them into the .ssh/authorized_keys -file. Is there any chance to get this working via openssl? Are the keys in PKCS#12 compatible

Using HTTPS with REST in Java

╄→尐↘猪︶ㄣ 提交于 2019-11-26 11:48:34
问题 I have a REST server made in Grizzly that uses HTTPS and works wonderfully with Firefox. Here\'s the code: //Build a new Servlet Adapter. ServletAdapter adapter=new ServletAdapter(); adapter.addInitParameter(\"com.sun.jersey.config.property.packages\", \"My.services\"); adapter.addInitParameter(ResourceConfig.PROPERTY_CONTAINER_REQUEST_FILTERS, SecurityFilter.class.getName()); adapter.setContextPath(\"/\"); adapter.setServletInstance(new ServletContainer()); //Configure SSL (See instructions

How can I generate a self-signed certificate with SubjectAltName using OpenSSL? [closed]

老子叫甜甜 提交于 2019-11-26 11:03:05
I am trying to generate a self-signed certificate with OpenSSL with SubjectAltName in it.While I am generating the csr for the certificate, my guess is I have to use v3 extensions of OpenSSL x509. I am using : openssl req -new -x509 -v3 -key private.key -out certificate.pem -days 730 Can someone help me with the exact syntax? jww Can someone help me with the exact syntax? Its a three step process, and it involves modifying openssl.cnf file. You might be able to do it with only command line options, but I don't do it that way. Find your openssl.cnf file. It is likely located in /usr/lib/ssl

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

CryptographicException 'Keyset does not exist', but only through WCF

允我心安 提交于 2019-11-26 06:14:35
问题 I have some code that makes a call to a third party web service that is secured using X.509 certification. If I call the code directly (using a unit test) it works without any problems. When deployed, this code will be called via a WCF Service. I have added a second unit test that calls the WCF Service, however this fails with a CryptographicException , message \"Keyset does not exist\" when I call a method on the third party web service. I presume that this is because my WCF Service will be