[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Private Key and Certificate in PEM format
From:       "Arthur Wongtschowski" <arthur () scopus ! com ! br>
Date:       2002-07-29 18:31:53
[Download RAW message or body]


  I've been able to generate a RSA key pair, including a RSA certificate
using BC. What I want now is to be able to save the Private Key and the
Certificate into files in my HD, where the key and certificate are in PEM
format, just like OpenSSL does. I did manage to save the Certificate Request
in PEM format, using the code below:

			ByteArrayOutputStream baos = new
ByteArrayOutputStream();
			DEROutputStream dos = new DEROutputStream(baos);
			dos.writeObject(req1);
			dos.close();
			baos.close();
			Requisicao = "-----BEGIN CERTIFICATE
REQUEST-----\n";
			String RequisicaoTemp = new
String(Base64.encode(baos.toByteArray()));
			int i, tam;
			for(i = 0; i < RequisicaoTemp.length(); i = i + 64)
			{
				if((i + 64) < RequisicaoTemp.length())
					tam = 64;
				else
					tam = RequisicaoTemp.length() - i;
					
				Requisicao = Requisicao +
RequisicaoTemp.substring(i, i + tam);
				Requisicao = Requisicao + "\n";
			}
			Requisicao = Requisicao + "-----END CERTIFICATE
REQUEST-----\n";

  Is there an equivalent to Certificates an Private Keys, where of course
the private key would be encrypted with a password of some sort ?? Any input
would be helpful. Thanks.

----------------------
Arthur Wongtschowski
SCOPUS Tecnologia S.A.
Segurança de Sistemas
Fone : 55 11 3909-3479
arthur@scopus.com.br




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic