x509certificate

Validate X.509 certificate against CA in Java

你说的曾经没有我的故事 提交于 2019-11-27 00:38:28
问题 Lets say I have something like this (client side code): TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } @Override public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType) { } @Override public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType) { } } }; SSLContext sslc = SSLContext.getInstance("TLS"); sslc

how to add subject alernative name to ssl certs?

穿精又带淫゛_ 提交于 2019-11-27 00:26:21
I'm using openssl to create self-signed certs. I'm getting this error with the certs I generated: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present Does anyone know how to specify "Subject alternative name" while creating a cert? This is how I'm generating a keystore: sudo $JAVA_HOME/bin/keytool -genkey -dname "CN=192.168.x.xxx, OU=I, O=I, L=T, ST=On, C=CA" -alias tomcat -validity 3650 -keyalg RSA -keystore /root/.keystore -keypass abcd -storepass abcd To generate a key: openssl s_client -connect 192.168.x.xxx:8443 2>/dev/null

CryptographicException was unhandled: System cannot find the specified file

天涯浪子 提交于 2019-11-27 00:05:44
问题 I am trying to embrace the mysteries of SSL communication and have found a great tutorial on this site. I was trying to test my own certificate. Using Visual Studio 2012, I simply added an existing file (my certificate in .pfx format) and then changed the "certificate" and "password" settings in app.config. However, when trying to run it, I got an error: CryptographicException was unhandled: System cannot find the specified file Then, I tried the same in my Web Service. There I got some more

Creating an X509 Certificate in Java without BouncyCastle?

梦想与她 提交于 2019-11-27 00:03:21
Is it possible to sanely create an X509 Certificate in Java code without using the Bouncy Castle X509V*CertificateGenerator classes? The ability to sign certificates is not part of a standard Java library or extension. A lot of the code that is needed to do it yourself is part of the core. There are classes to encode and decode X.500 names, X.509 certificate extensions, public keys for various algorithms, and of course, for actually performing the digital signature. Implementing this yourself is not trivial, but it is definitely doable—I probably spent 4 or 5 full days the first time I made a

Validating a certificate in java throws an exception - unable to find valid certificate path to requested target

耗尽温柔 提交于 2019-11-26 22:52:21
问题 I have a web app that requires a client to send it's certificate and the server has to validate the certificate(i.e see if the issuer is a valid issuer and present in the server's truststore). Here is the code : FileInputStream fin=new FileInputStream("C:/trustedca"); KeyStore anchors = KeyStore.getInstance("JKS","SUN"); anchors.load(fin, "server".toCharArray()); X509CertSelector target = new X509CertSelector(); FileInputStream fin1=new FileInputStream("C:/client.crt"); CertificateFactory cf

how to install CA certificate programmatically on Android without user interaction

与世无争的帅哥 提交于 2019-11-26 22:36:13
问题 I'm trying to install certificates without prompting the user. I know this is not good practice, but that's what PM wants. Using KeyChain.createInstallIntent(), I can get Android to launch the certificate installation dialog by calling startActivity . However, when I pass the intent to sendBroadcast , nothing happens. Maybe the platform doesn't support this for security reasons? String CERT_FILE = Environment.getExternalStorageDirectory() + "/test/IAT.crt"; Intent intent = KeyChain

How to verify chain in RemoteCertificateValidationCallback?

允我心安 提交于 2019-11-26 22:08:58
问题 I have the following code that attempts to verify a server certificate against the CA in my private PKI. Its used with ServicePointManager and RemoteCertificateValidationCallback : static bool VerifyServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { X509Certificate2 ca = new X509Certificate2(); ca.Import("ca-rsa-cert.der"); X509Chain chain2 = new X509Chain(); chain2.ChainPolicy.ExtraStore.Add(ca); // Check all properties chain2

Authentication failed because remote party has closed the transport stream

情到浓时终转凉″ 提交于 2019-11-26 22:04:35
I am developing a TCP client to connect OpenSSL server with the certificate authentication. I have using .crt and .key files shared by server team. These certificates are generated by OpenSSL commands. I am using SslStream object to authenticate the Tcp client by calling SslStream.AuthenticateAsClient method by passing server IP , SslProtocols.Ssl3 and X509CertificateCollection . I am getting the following error: Authentication failed because the remote party has closed the transport stream I would advise against restricting the SecurityProtocol to TLS 1.1. The recommended solution is to use

Problems reading authenticating a SAML assertion in .Net using WSSecurityTokenSerializer

我是研究僧i 提交于 2019-11-26 21:42:36
问题 I have a SAML assertion that I wish to authenticate in .Net using WSSecurityTokenSerializer . I've got the key-chain and SAML XML, despite a few issues. First I get the SAML assertion from the HTTPS POST: // spec says "SAMLResponse=" string rawSamlData = Request["SAMLResponse"]; // read the base64 encoded bytes byte[] samlData = Convert.FromBase64String(rawSamlData); // read back into a UTF string string samlAssertion = Encoding.UTF8.GetString(samlData); // get the SAML data in an XML reader

Generating X509 Certificate using Bouncy Castle Java

陌路散爱 提交于 2019-11-26 21:35:25
问题 I am looking for an example or tutorial to generate X509 Certificates using BC in Java. A lot of example are having/using deprecated API. I gave a look at BC, but it doesn't show which class does what or no proper documentation/example. Please If any one you are having idea about it, please point me to a tutorial where I can use BC to generate X509 Certificates. [Generation and writing the public and private keys to files] 回答1: The X509v3CertificateBuilder seems like the class to use. There