How to convert X509Certificate to .CER file?

I have an X509Certificate object with me. Now how can I write this X509Certificate object as a .cer file containing the public key on the hard disk?Can it be done with BouncyCastle? Please help!
[208 byte] By [Nortona] at [2007-10-3 9:41:36]
# 1

Once you have got your certificate do the following :

X509Certificate cert = <here get your cert ...>;

FileOutputStream fos = new FileOutputStream( <your .cer file>);

fos.write( cert.getEncoded() );

fos.flush();

fos.close();

Message was edited by:

henoch_herve

henoch_hervea at 2007-7-15 4:57:43 > top of Java-index,Security,Other Security APIs, Tools, and Issues...