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