x509

How do I get public key hash for SSL pinning?

末鹿安然 提交于 2019-11-29 21:33:28
How would I get the hash of a public certificate's info to be able to perform SSL Pinning in my application? I am using TrustKit in my iOS application and it is asking for me to set the hash that I am expecting. Where can I get this from? If it is a public website, you can use SSL Labs server test which computes and displays the pin. The Public Key Pinning page over at the Mozilla Developer Network also has commands for obtaining the pin from a key file, a certificate signing request, a certificate or a website (this is the one in @mylogon's answer ). Since this is a programming web-site, i

How to programmatically install a certificate using C#

非 Y 不嫁゛ 提交于 2019-11-29 21:05:56
my school webpages have selftrusted certificate(you must install it manually) and I wanted create program that will install a certificate.cer (from visual studio resources) to Local user -"Trusted root certificate authority" after i click on a button.Do you know how to code it in Visual C#? akton To add the certificate to the trusted root store for the current user programmatically, use the X509Store and X509Certificate2 classes. For example: string file; // Contains name of certificate file X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser); store.Open(OpenFlags

signing a xml document with x509 certificate

别等时光非礼了梦想. 提交于 2019-11-29 18:14:06
问题 Every time I try to send a signed XML, the web service verifier rejects it. To sign the document I just adapted this sample code provided by Microsoft: http://msdn.microsoft.com/es-es/library/ms229745(v=vs.110).aspx My implementation: public static XmlDocument FirmarXML(XmlDocument xmlDoc) { try { X509Certificate2 myCert = null; var store = new X509Store(StoreLocation.CurrentUser); //StoreLocation.LocalMachine fails too store.Open(OpenFlags.ReadOnly); var certificates = store.Certificates;

Extract pem certificate information programmatically using openssl

浪子不回头ぞ 提交于 2019-11-29 18:13:59
问题 Using the openssl command line is possible to extract, in a human readable mode, all the information contained in a .pem certificate; that is: openssl x509 -noout -in <MyCertificate>.pem -text What are the suitable steps in order to extract this information using the openssl API? Regards, 回答1: The X509_print_ex family of functions is your answer. #include <openssl/x509.h> #include <openssl/pem.h> #include <openssl/bio.h> int main(int argc, char **argv) { X509 *x509; BIO *i = BIO_new(BIO_s

how to get the Keyusage value from the X509 certificate?

不羁岁月 提交于 2019-11-29 16:17:59
I want to retrieve the Key usage value from the X509 structured certificate , i tried the following code X509* lcert=NULL; lCert=PEM_read(filename); // function will return the certificate in X509 unsigned long lKeyusage= lCert->ex_kusage; When i print the lKeyusage value .. some times i get 128 ... sometimes i get 0 for the same certificate .. Can any one tell me what is the error .? If i am doing wrong please give me some sample code or Correct API .. I think the easiest way is to use a memory BIO: ... X509 *lcert = NULL; BUF_MEM *bptr = NULL; char *buf = NULL; int loc; FILE *f = fopen("your

iOS MDM profile signing, which certificate to use?

和自甴很熟 提交于 2019-11-29 15:18:13
问题 Okay, so look at this diagram. There are two little boxes, that signify how a given profile should be signed. In Phase 2, step 1, it says "Apple issued certificate", but it doesn't say which apple issued certificate (they issue more than one). I have tried my developer certificate and the MDM (APNS) certificate. It wasn't one of those. Is there a third magic certificate I somehow need (and how do I get it)? In Phase 3, step 2, it says "Identity certificate", but again it's a little sketchy on

iPhone RSA algorithm with modulus and exponent [duplicate]

时光总嘲笑我的痴心妄想 提交于 2019-11-29 14:55:33
This question already has an answer here: RSA Encryption public key? 1 answer I have modulus and exponent. How can I encode/decode data with RSA algotithm on iPhone? Or how can I generate DER format from modulus and exponent? If you want to generate DER data on the iPhone, I have code on GitHub that will let you do this: https://github.com/StCredZero/SCZ-BasicEncodingRules-iOS SCZ-BasicEncodingRules-iOS Implementation of Basic Encoding Rules to enable import of RSA keys to iOS KeyChain using exponent. Code targets iOS 5 with ARC. Let's say you already have a modulus and exponent from an RSA

How to create a digital certificate and export to .p12 file in PHP?

给你一囗甜甜゛ 提交于 2019-11-29 11:47:45
How to create a digital certificate and export to .p12 file in PHP? I want the .p12 file to have private key included. And also want to check whether the key pair is already issued (logged in database). I found a function called 'openssl_pkcs12_export_to_file' but don't know where to start. Seems that I need an X509 cert and a private key first. <?php error_reporting(-1); function dump($Var) { echo "<hr/><pre>"; var_dump($Var); echo "</pre><hr/>"; } function check_errors() { echo "<hr/><pre>"; $Count = 0; while (($e=openssl_error_string())!==false) { echo $e."<br>"; $Count++; } if ($Count==0)

Verify errorcode = 20 : unable to get local issuer certificate

…衆ロ難τιáo~ 提交于 2019-11-29 05:15:06
I have a certificate chain in server: Certificate chain 0 s:/******/O=Foobar International BV/OU**** i:/C=US/O=Symantec Corporation/OU=Symantec Trust Network/**** 1 s:/C=US/O=Symantec Corporation/OU=Symantec Trust Network/**** i:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=**** - G5 2 s:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=**** - G5 i:/C=US/O=VeriSign, Inc./OU=Class 3 Public Primary Certification Authority And my local root CA certificate is: s:/C=US/O=Symantec Corporation/OU=Symantec Trust Network/**** i:/C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=**** - G5 And I

Check signature for x509 certificate

╄→尐↘猪︶ㄣ 提交于 2019-11-29 04:05:15
问题 I have: x509 certificate (Base64); String data; Signature of string data (Base64). Is it possible to check signature? My code: bool valid = false; var signature = Convert.FromBase64String(base64Signature); var data = Encoding.UTF8.GetBytes(stringData); var x509 = new X509Certificate2(Convert.FromBase64String(certificate)); var dsa = x509.PublicKey.Key as DSACryptoServiceProvider; if (dsa!=null) valid = dsa.VerifySignature(data, signature); else { var rsa = x509.PublicKey.Key as