public static void filterP12 ( File p12 , String p12Password ) throws IOException { if ( ! p12 . exists ( ) ) throw new IllegalArgumentException ( "p12 file does not exist: " + p12 . getPath ( ) ) ; final File pem ; if ( USE_GENERIC_TEMP_DIRECTORY ) pem = File . createTempFile ( UUID . randomUUID ( ) . toString ( ) , "" ) ; else pem = new File ( p12 . getAbsolutePath ( ) + ".pem.tmp" ) ; final String pemPassword = UUID . randomUUID ( ) . toString ( ) ; try { P12toPEM ( p12 , p12Password , pem , pemPassword ) ; PEMtoP12 ( pem , pemPassword , p12 , p12Password ) ; } finally { if ( pem . exists ( ) ) if ( ! pem . delete ( ) ) log . warn ( "[OpenSSLPKCS12] {filterP12} Could not delete temporary PEM file " + pem ) ; } }
Recreates a PKCS12 KeyStore using OpenSSL ; this is a workaround a BouncyCastle - Firefox compatibility bug