x509certificate

From certificate Alias to PEM File with private key included using Java

廉价感情. 提交于 2019-12-11 07:32:34
问题 I have this code to generate a CER file using the alias: public class TestFromAliasToCER { public static final int KEY_SIZE = 1024; public static final String BEGIN_CERT = "-----BEGIN CERTIFICATE-----"; public static final String END_CERT = "-----END CERTIFICATE-----"; public final static String LINE_SEPARATOR = System.getProperty("line.separator"); public static void main(String[] args) throws FileNotFoundException, IOException, NoSuchAlgorithmException, NoSuchProviderException,

C# Download all https certificates from a website

早过忘川 提交于 2019-12-11 07:24:41
问题 I want to save all certificates from a URL to disk. So for example https://www.google.de If I browse this page with Firefox, I can see three certificates. With Firefox I can export them all, and save them to disk. So I want to do that in C#. I started getting the certificates with the following code.. /// <summary> /// Get and write certificate from URL into file in path /// </summary> /// <param name="_URL">URL of website with certficate</param> /// <param name="_path">Path where you want to

How to operate with X509 certificates in .NET code

一世执手 提交于 2019-12-11 07:19:20
问题 I have some code that needs to work with X509 Certificate information. I have downloaded a sample that does this: const string CertWithoutPrivateKey = "MII...."; const string CertWithPrivateKey = "MII..."; public static SecurityToken GetSigningToken(bool includePrivateKey) { X509Certificate2 cert = null; if (includePrivateKey) { cert = new X509Certificate2( Convert.FromBase64String(CertWithPrivateKey), "pw", X509KeyStorageFlags.PersistKeySet); } else { cert = new X509Certificate2( Convert

Adding a new Extension to my generated certificate

冷暖自知 提交于 2019-12-11 06:28:02
问题 I need to add a new Extension of OID 1.3.6.1.5.5.7.1.26 in my certificate. I got this OID extension in my certificate but with the following error: Certificate Extensions: 10 [1]: ObjectId: 1.3.6.1.5.5.7.1.26 Criticality=false Extension unknown: DER encoded OCTET string = 0000: 04 0C 30 0A 13 08 33 39 20 64 63 20 32 62 ..0... 39 dc 2b I want this OID to be recognized similar to other extensions like AuthorityInfoAccess , etc. Do I need to edit the jar of Bouncy Castle X509 class? Im using

Get all certificates installed on Local machine

我是研究僧i 提交于 2019-12-11 06:24:38
问题 I have the following code to get the certificates: X509Store store = new X509Store("??","??"); List<X509Certificate2> lst = new List<X509Certificate2>(); store.Open(OpenFlags.ReadOnly); foreach (X509Certificate2 mCert in store.Certificates) { lst.Add(mCert); //TODO's } Now I want to get all the certificates installed on Local Machine in a list<> with Certificate Name, Their location, Issued with Public key Or Private Key(in Yes or No only) and the name of folder which contains those certs

Extract public key from certificate x509

馋奶兔 提交于 2019-12-11 06:02:09
问题 I am looking for a way to extract public key from certificate x509 (PEM format) in javascript like this one: openssl x509 -in cert.cer -pubkey -noout > pub.txt 回答1: You need something that can parse ASN.1 structure. You could use pkijs. Demo can be found here 回答2: var cert = forge.pki.certificateFromPem(pem); var pem = forge.pki.publicKeyToPem(cert.publicKey) Thanks halloulaguesmi. This seems to be working perfectly. 来源: https://stackoverflow.com/questions/44675333/extract-public-key-from

X509 RSA bouncy castle sign and verify plain text in Java

五迷三道 提交于 2019-12-11 04:45:26
问题 I am currently writing a Java program using BouncyCastle that generates an X509 SSL certificate with an RSA key pair. I have been able to successfully create the SSL cert but I also want the ability to then sign arbitrary plain text and with that signature verify ownership of the keys by verifying the signature against the plain text. The methods should look something like this: protected String SignData(String privateKey, String text) { //return a signature } and protected boolean

How to sign the document with a certificate's private key from the browser (CAPICOM alternative)?

冷暖自知 提交于 2019-12-11 03:48:44
问题 So, till Windows 7 there was a Microsoft ActiveX component: CAPICOM, which one could call from Javascript and then show the contents of the certificate storage on the client's machine. The client then could choose the appropriate certificate and sign some document with the certificate's private key. That's how the access to the certificate storage looked in Javascript: var MyStore = new ActiveXObject("CAPICOM.Store"); var oCertificates = new ActiveXObject("CAPICOM.Certificates"); // attempt

Converting .cer to .jks using java

允我心安 提交于 2019-12-11 03:16:46
问题 I wanted to convert a file with a .cer extension to .jks file. Can somebody please help me with this? I googled it but did not get much information. Even a tutorial or link would is fine. I guess Java Key Store is used. Thanks. 回答1: I use BouncyCastle library, latest version (1.51) String certificateString = textSerializer.readStringFromFile(context, certificateFileName); //CERT IN PEM X509CertificateHolder x509CertificateHolder = pemConverter.convertPEMtoX509CertificateHolder