Can a public key be exported in PEM format rather than DER format using BouncyCastle?

StackOverflow https://stackoverflow.com/questions/12892705

  •  07-07-2021
  •  | 
  •  

سؤال

I currently use bouncy castle to generate a RSA key pair and export them into files. Currently, the keys are exported in DER format. I would like to know if it is possible to export them in .PEM format instead.

هل كانت مفيدة؟

المحلول

Depending on your code (which you are not showing) just use PemWriter.

public class PEMWriter
extends org.bouncycastle.util.io.pem.PemWriter

Or convert outside with

 openssl x509 inform=DER in=in.der outform=PEM out=out.pem
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top