x509certificate

How to generate certificate if private key is in HSM?

ぃ、小莉子 提交于 2020-01-01 09:11:07
问题 I often use openssl to generate RSA key and certificate. But now i encounter a problem. openssl x509 -req require private key as input. But now we're using HSM to protect private key and I'll never be able to touch the private key. In this way how do i suppose to generate a x509 certificate? 回答1: I've seen some HSMs come with their own support programs ready to use for a variety of things including key generation and cert or CSR creation, or make them available (for example on the vendor

Get Private Key from BouncyCastle X509 Certificate? C#

老子叫甜甜 提交于 2020-01-01 04:27:08
问题 Normally when I grab an X509Certificate2 out of my keystore I can call .PrivateKey to retrieve the cert's private key as an AsymmetricAlgorithm . However I have decided to use Bouncy Castle and its instance of X509Certificate only has a getPublicKey(); I cannot see a way to get the private key out of the cert. Any ideas? I get the an X509Certificate2 from my Windows-MY keystore then use: //mycert is an X509Certificate2 retrieved from Windows-MY Keystore X509CertificateParser certParser = new

Store X509 Certificate in database

限于喜欢 提交于 2020-01-01 02:47:06
问题 In order to access to the web service I need a certificate. I generated my certs: openssl genrsa 1024 > private.key openssl req -new -x509 -nodes -sha1 -days 1100 -key private.key > public.cer then merged this two into a pfx certificate by openssl pkcs12 -in public.cer -inkey private.key -export -out client.pfx then loaded my pfx file as X509Certificate2 X509Certificate2 clientCert = new X509Certificate2("cert.pfx", "password"); Now, I would like to create a table into the data base that

HTTP-Redirect Binding SAML Request

℡╲_俬逩灬. 提交于 2019-12-30 07:28:46
问题 Suppose SP-init SSO is carried out, HTTP-Redirect Binding is used instead of HTTP-POST Binding and signed AuthnRequest is required. It means to include the SAMLRequest in the URL. Q1. Do I need to include the signature in the URL or just embed in the SAMLRequest ? The redirect url is http://idp.example.com/SSOService.php?SAMLRequest={val1}&Signature={val2}&SigAlg={val3} with my SAMLRequest (without signature) <samlp:AuthnRequest ID="" Version="2.0" IssueInstant="2015-05-22T02:47:38Z"

How to parse a SAML assertion request in .Net

你离开我真会死。 提交于 2019-12-30 06:46:26
问题 I'm trying to implement a SAML SSO solution in .Net, but I'm having a problem parsing the assertion. I have a sample assertion (looks like byte[] data as text) and corresponding .p7b file. I want to load the keys from the .p7b and decrypt the assertion to an XML document. So far I think I'm reading the keys correctly: // get the key data byte[] certificateData = System.IO.File.ReadAllBytes("myKeys.p7b"); // decode the keys var cms = new SignedCms(SubjectIdentifierType.IssuerAndSerialNumber);

Loading X509Certificate results in exception CryptographicException “Cannot find the original signer”

核能气质少年 提交于 2019-12-30 05:54:38
问题 I am trying to instantiate an X509Certificate object, but I keep running into the same CryptographicException , with the error message: "Cannot find the original signer". I have tried several ways of loading the certificate: // some different things that I have tried var cert = X509Certificate.CreateFromCertFile(certFileName); var cert2 = new X509Certificate(byteArray); var cert3 = new X509Certificate(byteArray, secretString); var cert4 = X509Certificate.CreateFromSignedFile(certFileName); I

How to retrieve all certificates in your X509Store

爱⌒轻易说出口 提交于 2019-12-30 03:38:07
问题 I am using the following code to retrieve all certificates in my PC from an asp.net webapp. The certificates collection is empty, and I can't understand why. I tried impersonating my own user account and I didn't succeed as well. What am I doing wrong? var store = new X509Store(StoreLocation.CurrentUser); //StoreLocation.LocalMachine fails too var certificates = store.Certificates; foreach (var certificate in certificates) { var friendlyName = certificate.FriendlyName; Console.WriteLine

HTTPS request fails using HttpClient

丶灬走出姿态 提交于 2019-12-30 02:39:08
问题 I am using the following code and get HttpRequestException exception: using (var handler = new HttpClientHandler()) { handler.ClientCertificateOptions = ClientCertificateOption.Manual; handler.SslProtocols = SslProtocols.Tls12; handler.ClientCertificates.Add(new X509Certificate2(@"C:\certificates\cert.pfx")); // I also tried to add another certificates that was provided to https access // by administrators of the site, but it still doesn't work. //handler.ClientCertificates.Add(new

How do I check if an X509 certificate has been revoked in Java?

末鹿安然 提交于 2019-12-30 02:32:06
问题 I have googled around all over the place for this, and asked in other communities, and I keep getting forwarded to the oracle document that discusses the spec. However, that document more covers the naming of methods, and the overall architecture, and doesn't actually come up with a way to discuss how to actually write some code to check if an x509 cert is revoked or not. Maybe this one is just way over my head? But I would definitely appreciate if someone could just help me out with a

System.Net.CertificatePolicy to ServerCertificateValidationCallback Accept all certificate policies

☆樱花仙子☆ 提交于 2019-12-30 02:17:26
问题 I've downloaded some sample code that is a bit outdated. It has the following class: public class TrustAllCertificatePolicy : System.Net.ICertificatePolicy { public TrustAllCertificatePolicy() { } public bool CheckValidationResult(ServicePoint sp, System.Security.Cryptography.X509Certificates.X509Certificate cert, WebRequest req, int problem) { return true; } } later on in the code it calls the following: System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy(); It