x509certificate

X509Certificate - Keyset does not exist

隐身守侯 提交于 2019-11-26 19:59:44
问题 I have a WinForms application that consumes a WCF, and pass as a parameter to a function a certificate: mySvcClient.SendDocument(cert.Export(X509ContentType.SerializedCert, "password")); ... In WCF service , I recreated the certificate from the array of bytes: public void SendDocument (byte[] binaryCert) { X509Certificate2 cert = new X509Certificate2(binaryCert, "password"); ... But when using the certificate to sign a xml, I got the error "Keyset does not exist": if (cert.HasPrivateKey) //

Problems with X509Store Certificates.Find FindByThumbprint

让人想犯罪 __ 提交于 2019-11-26 19:36:17
问题 I'm having a problem when I use the method X509Store.Certificates.Find public static X509Certificate2 FromStore(StoreName storeName, StoreLocation storeLocation, X509FindType findType, string findValue) { X509Store store = new X509Store(storeName, storeLocation); store.Open(OpenFlags.ReadOnly); try { //findValue = "7a6fa503ab57b81d6318a51ca265e739a51ce660" var results = store.Certificates.Find(findType, findValue, true); return results[0]; } finally { store.Close(); } } In this case the Find

Generate Subject Hash of X509Certificate in Java

…衆ロ難τιáo~ 提交于 2019-11-26 18:30:32
问题 I'm currently trying to generate the subject hash by using the Java Security API and BouncyCastle. Here's what I do, when I use the Openssl Library: openssl x509 -in /Users/Sn0wfreezeDev/Downloads/Test.pem -hash This generates a short 8 digit hash 1817886a This is my Java code X509Certificate cert = CertManager.getCertificate(number, c); MessageDigest sha1 = MessageDigest.getInstance("SHA1"); System.out.println(" Subject " + cert.getSubjectDN()); System.out.println(" Issuer " + cert

Force HttpWebRequest to send client certificate

两盒软妹~` 提交于 2019-11-26 17:49:21
问题 I have a p12 certificate, that I load it in this way: X509Certificate2 certificate = new X509Certificate2(certName, password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable); It is loaded correcty, in fact If i do certificate.PrivateKey.ToXmlString(true); it returns a complete xml without errors. But If I do: try { X509Chain chain = new X509Chain(); var chainBuilt = chain.Build(certificate); Console.WriteLine("Chain building status: "+

PKCS12 Java Keystore from CA and User certificate in java

為{幸葍}努か 提交于 2019-11-26 16:37:30
问题 I've recently been put in charge of mocking up an Apple product (iPhone Configuration Utility) in Java. One of the sections I've been a bit stuck on is a part about Exchange ActiveSync. In there, it allows you to select a certificate from your Keychain to use as credentials for your EAS account. After some research, I found that it's actually creating a PKCS12 keystore, inserting the private key of the certificate I selected, and encoding that into XML. So far not a big deal. If I create a

Debugging failing HTTPS WebRequest

大兔子大兔子 提交于 2019-11-26 16:36:41
问题 I'm writing a small program which will make a GET request to a server using HTTPS and the HttpWebRequest class. The server (obviously) has a server certificate. It also expects the client to provide a certificate. When making the request, however, I get a System.Net.WebException stating that it wasn't possible to establish a secure TLS/SSL connection. I quickly discovered that the server's certificate wasn't valid. Assuming this was what was causing the exception, I tried to accept the

Signing SOAP messages using X.509 certificate from WCF service to Java webservice

拟墨画扇 提交于 2019-11-26 16:18:55
问题 It's my first question over the web. Hope it will make sense. I have seen several blogs related to this issue over the Web, and I have tried few of the ideas presented in them with no success. Here's my situation: I have a web App calling a WCF web service which then call a Java web service. They are all on different servers. The call between the WCF web service to the java web service is not over https as the certificate will be enough to identify the caller (Message security therefore).

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

IE9, Automation server can't create object error while using CertEnroll.dll

无人久伴 提交于 2019-11-26 14:29:40
问题 In my web page, a JS block like this: var classFactory = new ActiveXObject("X509Enrollment.CX509EnrollmentWebClassFactory"); // Other initialize CertEnroll Objects It works fine in windows7(32bit or 64bit) with IE8(32bit) , as long as I change the IE8 secure setting, enable Initializing and Script ActiveX controls not marked as safe. But when use IE9(32bit), I try anything I can find on web, it reports error "Automation server can't create object." I even created a static html file, save it

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

妖精的绣舞 提交于 2019-11-26 14:01:48
This question already has an answer here: How to import an existing X.509 certificate and private key in Java keystore to use in SSL? 15 answers 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 server.key -out server.csr 3) Generate self signed expiry-time 10 years openssl x509 -sha256 -days 3652 -in server.csr