I need to check if a file is pkcs#8 DER format in Java when uploading the file, I think maybe PKCS8EncodedKeySpec and getFormat() can be used. All the files input will get the “It’s pkcs8.” result. I realize “PKCS8EncodedKeySpec” will create the pkcs#8 key, but I don’t know using which class to replace it. Note that: both of PKCS#8 and
Tag: der
How read a PKCS8 encrypted Private key which is also encoded in DER with bouncycastle?
I have tried answers of these questions: Bouncy Castle : PEMReader => PEMParser Read an encrypted private key with bouncycastle/spongycastle However as my encrypted key is encoded in DER when I call object is null. I can convert it to PEM with this openssl’s command (it decrypts the key too) but I need to read the key in its original
Write x509 certificate into PEM formatted string in java?
Is there some high level way to write an X509Certificate into a PEM formatted string? Currently I’m doing x509cert.encode() to write it into a DER formatted string, then base 64 encoding it and appending the header and footer to create a PEM string, but it seems bad. Especially since I have to throw in line breaks too. Answer This is