Skip to content

Instantly share code, notes, and snippets.

Avatar

Enrico Bianchi henryx

View GitHub Profile
@henryx
henryx / ReadPKCS8.java
Created May 19, 2020
Read PKCS#8 RSA key
View ReadPKCS8.java
public class ReadPKCS8 {
/**
Read PKCS#8 RSA key, with or without passphrase. It requires Bouncycastle library
*/
public static void main(String[] args) throws IOException, PKCSException, OperatorCreationException {
var file = "a_pkcs8_rsa_key.p8";
var password = "passphrase";
Security.addProvider(new BouncyCastleProvider());