KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > protocol > ws > common > CertificateHelper


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13 package org.ejbca.core.protocol.ws.common;
14
15 import java.io.ByteArrayInputStream JavaDoc;
16 import java.security.cert.CertificateException JavaDoc;
17 import java.security.cert.CertificateFactory JavaDoc;
18
19 import org.ejbca.util.Base64;
20 import org.ejbca.util.CertTools;
21
22 /**
23  * Class used to generate a java.security.Certificate from a
24  * org.ejbca.core.protocol.ws.common.Certificate
25  *
26  * @author Philip Vendil
27  *
28  * $id$
29  */

30 public class CertificateHelper {
31
32     
33     public static java.security.cert.Certificate JavaDoc getCertificate(byte[] certificateData) throws CertificateException JavaDoc{
34         CertificateFactory JavaDoc cf = CertTools.getCertificateFactory();
35         java.security.cert.Certificate JavaDoc retval = cf.generateCertificate(new ByteArrayInputStream JavaDoc(Base64.decode(certificateData)));
36         return retval;
37     }
38 }
39
Popular Tags