x509certificate

How can I encrypt, decrypt and sign using .pfx certificate?

徘徊边缘 提交于 2019-12-07 17:00:52
问题 I have a .pfx certificate file on my computer. I want to to encrypt a message with its public key, and then decrypt it with the private. Also I want to sign another message with its private key, and then check the signature. And I need to get the information about the sertificate the message was signed with from that message. How can I do it using System.Security.Cryptography? 回答1: You can open the PFX in .NET, like the following: var path = <YOUR PFX FILE PATH>; var password = <YOUR PASSWORD

Generating X.509 Certificate using Bouncy Castle Java API

一个人想着一个人 提交于 2019-12-07 14:47:49
问题 I am trying to generate a X.509 Certificate using Bouncy Castle Java API. I found sample code at: http://www.bouncycastle.org/wiki/display/JA1/X.509+Public+Key+Certificate+and+Certification+Request+Generation However, after compile the below codes, JVM shows an error message as shown below Could not find the main class: org.bouncycastle.util.AllTests. Program will exit. Note that org.bouncycastle.util.AllTests is inserted into the Java build path. How can I fix my code to work properly?

WCF error: Cannot find a token authenticator [duplicate]

二次信任 提交于 2019-12-07 13:17:01
问题 This question already has answers here : WCF - Cannot find a token authenticator for X509SecurityToken (2 answers) Closed 3 years ago . i need to consume WCF service over SSL while the request needs to be sign with one certificate and the response needs to be validated with another certificate. i get this error while executing the code: Cannot find a token authenticator for the 'System.IdentityModel.Tokens.X509SecurityToken' token type. Tokens of that type cannot be accepted according to

how to programmatically acces the window and mac trusted certificate store

大憨熊 提交于 2019-12-07 12:41:00
问题 Create a selfsigned java keystore and certificate file using keytool utility. Am able to add the certificate into windows trust store by going to certificate console by using mmc.exe command. But is there anyway to add the certificate into windows trust store programmatically. And also required the same things for MAC system. Appreciate for any suggestions. 回答1: Below is code snippet for Windows/MAC to add certificate in their trust store. Window: KeyStore root = KeyStore.getInstance("Windows

When using Client Certificate Authentication, why do I keep getting NSURLErrorDomain Code=-1206?

寵の児 提交于 2019-12-07 12:36:43
问题 The following code is me using code from previous posts about ios client certificate authentication. Every says this works, however why does it work for me?!?! I keep getting the following error: connection didFailWithError: Error Domain=NSURLErrorDomain Code=-1206 "The server “www.mywebsite.com” requires a client certificate. I've followed at least 4 posts about this same topic on stackoverflow and 2 on other similar sites. They all say the same thing, except it isn't working. I know my

Read certificate from pdf

限于喜欢 提交于 2019-12-07 09:25:08
问题 I'm using ITextSharp in order to read certificate informations from digitally signed pdf document. The ITextSharp.Text.Pdf.PdfPKCS7 class exposes three properties: Certificates (as list) SignCertificate (as single object) SignCertificateChain (as list) How can I combine these three properties in order to achieve all info about a single certificate? I'd be able to show all certificate path (all nested certificates). 回答1: Certificates gives you the list in no particular order, including

How to use JKS certificate for NODE https client request

*爱你&永不变心* 提交于 2019-12-07 09:21:07
问题 I would like to use certificate from a JKS keystore within a NodeJS application. var fs = require('fs'); var https = require('https'); var options = { hostname: 'XXX.com', port: 4443, path: '/endpoint', method: 'GET', key: fs.readFileSync('private.pem'), cert: fs.readFileSync('public.pem'), }; var req = https.request(options, function(res) { res.on('data', function(data) { process.stdout.write(data); }); }); req.end(); req.on('error', function(e) { console.error(e); }); How can i convert the

How to instantiate javax.security.X509Certficate object from a p12 certificate (contains certificate + private key)

二次信任 提交于 2019-12-07 06:57:51
问题 X509Certificate is only instantiatable using the contents of a certificate (.cer file). How to instantiate this object using a .p12 file that contains both the certificate and the private key? 回答1: Here is what you need: InputStream inStream = new FileInputStream("c:/certificate.p12"); KeyStore ks = KeyStore.getInstance("PKCS12"); ks.load(inStream, "password".toCharArray()); String alias = ks.aliases().nextElement(); certificate = (X509Certificate) ks.getCertificate(alias); 来源: https:/

Using X509Certificate with file and key in c#

江枫思渺然 提交于 2019-12-07 05:37:10
问题 I have given certificate and password to a server that accepts ssl connection. I tried to make a connection to this server but authentication fails, well mainly because I dont know how to use that file and password that I was given. Here is my code: X509Certificate certificate = new X509Certificate( @"c:\mySrvKeystore", KEY_PASSWORD); public static bool ValidateCertificate( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { if (errors == SslPolicyErrors

Correct way to import root and intermediate certifiacts in Java cacerts

只愿长相守 提交于 2019-12-07 03:03:26
My company has its own ROOT certificate. Using this certificate they signed intermediate certificate. Then we issued CSR for server certificate and signed it with intermediate certificate. What is a correct way to import the ROOT certificate and intermediate in Java cacerts file, in order to be able to establish SSL connection with the server which has server certificate signed by the intermediate ? I used OpenSSL to test certificate chain on the server: openssl s_client -showcerts -connect host:443 CONNECTED(00000003) depth=0 C = COUNTRYCODE, ST = myCountry, O = myOrganization, CN = myServer,