Skip to content
Advertisement

Tag: der

How to check if a file is pkcs#8 DER format in Java?

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

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

Advertisement