How can I decode a SSL certificate using python?

Python’s standard library, even in the latest version, does not include anything that can decode X.509 certificates. However, the add-on cryptography package does support this. Quoting an example from the documentation: >>> from cryptography import x509 >>> from cryptography.hazmat.backends import default_backend >>> cert = x509.load_pem_x509_certificate(pem_data, default_backend()) >>> cert.serial_number 2 Another add-on package that might be … Read more

RestTemplate with pem certificate

So knowledge about using pem certificate with RestTemplate is distracted. Steps which must be done: Add server certificate to trustStore, using keytool or portecle. When you want to use custom trusttore use this script Next configure ssl to RestTemplate. It may be done like below: @Configuration public class SSLConfiguration { @Value(“${certificate.name}”) private String name; @Bean(name … Read more

Load an PEM encoded X.509 certificate into Windows CryptoAPI

KJKHyperion said in his answer: I discovered the “magic” sequence of calls to import a RSA public key in PEM format. Here you go: decode the key into a binary blob with CryptStringToBinary; pass CRYPT_STRING_BASE64HEADER in dwFlags decode the binary key blob into a CERT_PUBLIC_KEY_INFO with CryptDecodeObjectEx; pass X509_ASN_ENCODING in dwCertEncodingType and X509_PUBLIC_KEY_INFO in lpszStructType … Read more

How to build a SSLSocketFactory from PEM certificate and key without converting to keystore?

It turned out that a KeyStore instance still has to be built, but it can be done in memory (starting with PEM files as input), without using an intermediate keystore file build with keytool. To build that in-memory KeyStore, code like the following may be used: private static final String TEMPORARY_KEY_PASSWORD = “changeit”; private KeyStore … Read more

Convert PEM to PPK file format

Use PuTTYGen Creating and Using SSH Keys Overview vCloud Express now has the ability to create SSH Keys for Linux servers. This function will allow the user to create multiple custom keys by selecting the “My Account/Key Management” option. Once the key has been created the user will be required to select the desired SSH … Read more

Using a PEM encoded, encrypted private key to sign a message natively

If you’re using BouncyCastle, try the following: import java.io.File; import java.io.FileReader; import java.io.IOException; import java.security.KeyPair; import java.security.Security; import java.security.Signature; import java.util.Arrays; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.openssl.PEMReader; import org.bouncycastle.openssl.PasswordFinder; import org.bouncycastle.util.encoders.Hex; public class SignatureExample { public static void main(String [] args) throws Exception { Security.addProvider(new BouncyCastleProvider()); String message = “hello world”; File privateKey = new File(“private.pem”); KeyPair … Read more