x509certificate

Retrieve Subject alternative names of X.509 certificate in java

谁说胖子不能爱 提交于 2020-06-23 06:45:28
问题 I have tried using the solution provided in this link. I am getting following error when i tried reading subject alternative names of X.509 Certificate java.lang.NoSuchMethodError: org.bouncycastle.asn1.ASN1InputStream.readObject()Lorg/bouncycastle/asn1/DERObject; At below line of code ASN1InputStream decoder = new ASN1InputStream((byte[]) item.toArray()); DEREncodable encoded = decoder.readObject(); .der file is used to create certificate as follows. X509Certificate cert=null; fis = new

How to generate a self-signed certificate using only JDK supported classes?

a 夏天 提交于 2020-05-25 01:11:34
问题 I have a program in Java which currently uses private JDK classes ( CertAndKeyGen and X500Name ) to generate self-signed X.509 certificates. There are too many problems with this approach: the internal package(s) keep changing: "sun.security.x509.CertAndKeyGen", // Oracle/Sun/OpenJDK 6,7 "sun.security.tools.keytool.CertAndKeyGen", // Oracle/Sun/OpenJDK 8 "com.ibm.security.x509.CertAndKeyGen", // IBM SDK 7 "com.ibm.security.tools.CertAndKeyGen" // IBM SDK 8 Apparently a JDK 7 update (u111?)

How to generate a self-signed certificate using only JDK supported classes?

♀尐吖头ヾ 提交于 2020-05-25 01:11:13
问题 I have a program in Java which currently uses private JDK classes ( CertAndKeyGen and X500Name ) to generate self-signed X.509 certificates. There are too many problems with this approach: the internal package(s) keep changing: "sun.security.x509.CertAndKeyGen", // Oracle/Sun/OpenJDK 6,7 "sun.security.tools.keytool.CertAndKeyGen", // Oracle/Sun/OpenJDK 8 "com.ibm.security.x509.CertAndKeyGen", // IBM SDK 7 "com.ibm.security.tools.CertAndKeyGen" // IBM SDK 8 Apparently a JDK 7 update (u111?)

Xamarin.Android Http client that allow me to add client certificate from KeyStore [duplicate]

时光毁灭记忆、已成空白 提交于 2020-04-18 02:55:14
问题 This question already has answers here : xamarin.android adding client certificate (2 answers) Closed 5 days ago . I am trying to add client certificate whitch I am getting from this method: private X509Certificate[] GetCertificateChain(string alias) { try { return KeyChain.GetCertificateChain(this, alias); } catch (KeyChainException e) { } return null; } System.Net.Http.HttpClientHandler doesn't allow me to addclient certificate. NotImplemented exception is thrown. Any solution? Maybe other

Create X509Certificate2 from PEM file in .NET Core

大城市里の小女人 提交于 2020-04-09 17:54:42
问题 I want to create a X509Certificate2 object based on a PEM file. The problem is setting the PrivateKey property of X509Certificate2. I read X509Certificate2.CreateFromCertFile() on .NET Core and then used var rsa = new RSACryptoServiceProvider(); rsa.ImportCspBlob(pvk); Where pvk is the byte array of the private key (read from GetBytesFromPEM as shown here how to get private key from PEM file?), to set the private key, but then I get an Internal.Cryptography.CryptoThrowHelper

Export PublicKey and PrivateKey from PKCS12 file

我们两清 提交于 2020-03-22 07:21:12
问题 I have a .p12 file and I want to export a public and private keys. I used this method: FileInputStream fm = new FileInputStream("C:\\cert.p12"); KeyStore ks = KeyStore.getInstance("PKCS12"); try { ks.load(fm, "pass".toCharArray()); } catch (Exception e) { e.printStackTrace(); } Key key = ks.getKey("cert", "pass".toCharArray()); Certificate cert = ks.getCertificate("cert"); PublicKey publicKey = cert.getPublicKey(); System.out.println("Public key"); System.out.println(Base64.getEncoder()

Android and Client Certificates

落花浮王杯 提交于 2020-02-28 07:55:29
问题 I have been searching for this for a few weeks and can't seem to find an answer anywhere. I am trying to do the following for Android. This code is from a C# app I wrote but am porting it to Android. The web endpoint requires a cert to be attached to the request for mutual authentication to make the web service call. string certThumbprint = "E1313F6A2D770783868755D016CE748F6A9B0028"; X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser); try { certStore.Open(OpenFlags

Android and Client Certificates

主宰稳场 提交于 2020-02-28 07:54:25
问题 I have been searching for this for a few weeks and can't seem to find an answer anywhere. I am trying to do the following for Android. This code is from a C# app I wrote but am porting it to Android. The web endpoint requires a cert to be attached to the request for mutual authentication to make the web service call. string certThumbprint = "E1313F6A2D770783868755D016CE748F6A9B0028"; X509Store certStore = new X509Store(StoreName.My, StoreLocation.CurrentUser); try { certStore.Open(OpenFlags

How to force WebBrowser control to select one specific client certificate?

强颜欢笑 提交于 2020-02-23 07:05:52
问题 Anyone knows how to force the WebBrowser control to automatically select a specific client certificate and not open the pop up with client certificates list? 回答1: I solved this issue changing the certificate purposes to "Disable all purposes for this certificate", so just the certificate with the desired purpose could be used by WebBrowser control. 来源: https://stackoverflow.com/questions/4388149/how-to-force-webbrowser-control-to-select-one-specific-client-certificate

How to force WebBrowser control to select one specific client certificate?

≡放荡痞女 提交于 2020-02-23 07:05:11
问题 Anyone knows how to force the WebBrowser control to automatically select a specific client certificate and not open the pop up with client certificates list? 回答1: I solved this issue changing the certificate purposes to "Disable all purposes for this certificate", so just the certificate with the desired purpose could be used by WebBrowser control. 来源: https://stackoverflow.com/questions/4388149/how-to-force-webbrowser-control-to-select-one-specific-client-certificate