x509certificate

openssl command in php

大憨熊 提交于 2019-12-13 00:17:01
问题 I want to generate example.com.crt and example.com.pem using php. The Linux command to get the files is given: openssl req -newkey rsa:2048 -new -x509 -days 3652 -nodes -out example.com.crt -keyout example.com.pem I want to get the two file contents in two string in php. What is the php equivalent code for this? UPDATE: Please don't ask to execute the Linux command. 回答1: You could use phpseclib, a pure PHP X.509 implementation: http://phpseclib.sourceforge.net/x509/examples.html#selfsigned <

how to verify a P12 certificate using openssl?

别说谁变了你拦得住时间么 提交于 2019-12-12 21:34:34
问题 Can anyone tell me how to verify the Password-based P12 file using openssl? Logic or sample code will be much helpful. 回答1: You can find a code sample that : - opens a pkcs#12 file with password - extracts the private key and certificates in the openssl source code at : ./demos/pkcs12/pkread.c 来源: https://stackoverflow.com/questions/6750533/how-to-verify-a-p12-certificate-using-openssl

OpenSSL x509 Certificate: Add Extension with X509_add1_ext_i2d()

假如想象 提交于 2019-12-12 19:22:53
问题 Context: I'm generating an x509 Certificate using APIs in OpenSSL. I first create the X509 structure like this: X509 *x509 = X509_new(); // Assume no errors What I'm trying to do: Now I want to add an extension to this Certificate. Specifically, I want to set the "Extended Key Usage" extension to the value serverAuth,clientAuth . To do this, I am attempting to use the OpenSSL function x509_add1_ext_i2d() , which has the following signature: X509_add1_ext_i2d(X509 *x, int nid, void *value, int

receiving X509 client certificates in web requests

我只是一个虾纸丫 提交于 2019-12-12 18:36:48
问题 I am trying to send an X509Certificate from an Http Handler to a web service that will receive and read the certificate to authenticate the user. I know the certificate is sending fine; I have a tester that lets me look at the HttpWebRequest before sending, and the ClientCertificates property shows that it has a certificate attached. (e.g. request.ClientCertificates.Count = 1 ). However, on the other side on the web service, HttpRequest.ClientCertificate is consistently showing NULL . I have

Why I am getting an error while opening digitally signed pdf document using PKCS7 and X509Certificate in C#?

无人久伴 提交于 2019-12-12 18:25:34
问题 I am trying to sign a pdf file using PKCS7 and X509Certificate but I get the following error when I open the signed pdf file in Adobe. Document has been altered or corrupted since it was signed Docuement Hash 66305799d97adc716694faa3aecb3b82136a76a57e0470fb289dcf727b83304b Following is my code: public class Helper { private static PdfPKCS7 _signature; private static PdfSignatureAppearance _apperance; private static byte[] _hash; private static byte[] _signatureHash; public static byte[]

How to convert BouncyCastle X509Certificate to .NET Standard X509Certificate2 while retaining the private key?

落爺英雄遲暮 提交于 2019-12-12 14:19:12
问题 I need to convert a generated BouncyCastle X509Certificate to X509Certificate2 with the private key getting loaded in the resulting .NET Standard X509Certificate2 object. Is that possible? There is an answer for a similar question https://stackoverflow.com/a/8150799/5048935 , but after generating a BouncyCastle certificate and converting it to .NET X509Certificate2 the resulting object has its HasPrivateKey property set to "false". Context I need to load a certificate and a private key

API secured by PKCS#7 cryptographic message

纵然是瞬间 提交于 2019-12-12 13:19:12
问题 I am currently trying to call an API that requires me to put XML data in a PKCS#7 format. This data is posted to the API end point. The response also comes in a form of a PKCS#7 cryptographic messages (MIME-type is application/pkcs7-mime). Some Notes they provide: A cryptographic message doesn't contain any certification chains. Data compression is not used. Data encryption is not used. A cryptographic message is in the OpenSSL PEM format. I have been supplied two certificates. One I created

Java: Read certificates from windows store

风格不统一 提交于 2019-12-12 12:18:33
问题 It is possible to write a Java program to read one certificate (getting private and public key) stored in windows certificate store ? Thanks 回答1: If you are on Java 6, you can use the MSCAPI keystore to read it. Just open your keystore like this, KeyStore msCertStore = KeyStore.getInstance("Windows-MY", "SunMSCAPI"); 来源: https://stackoverflow.com/questions/3024442/java-read-certificates-from-windows-store

Android system certificate

萝らか妹 提交于 2019-12-12 10:22:59
问题 I hope you can help me! I have a Samsung i-9000 and i'm writing an application to enter the pin code of the SIM card if it has not already been done before. I inserted android:sharedUserId="android.uid.system" in AndroidManifest.xml and the code in my Activty class is: TelephonyManager tm = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); clazz = Class.forName(tm.getClass().getName()); m = clazz.getDeclaredMethod("getITelephony"); m.setAccessible(true); it = (ITelephony)m.invoke

Programmatic WCF Message Security with Certificates

六眼飞鱼酱① 提交于 2019-12-12 07:31:13
问题 I've written a self-hosted WCF service using WSHttpBindings and I'm trying to implement message-level security using certificates I've generated myself. Unfortunately I'm getting a buried exception (via the Service Trace Viewer) stating "The credentials supplied to the package were not recognized." A couple notes: This has to be done in code, not in configuration (Server/Client)Cert are certificates that are in the local machine store with accessible private keys to my user while debugging. I