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; 16 import java.security.cert.CertificateException; 17 import java.security.cert.CertificateFactory; 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 getCertificate(byte[] certificateData) throws CertificateException{ 34 CertificateFactory cf = CertTools.getCertificateFactory(); 35 java.security.cert.Certificate retval = cf.generateCertificate(new ByteArrayInputStream(Base64.decode(certificateData))); 36 return retval; 37 } 38 } 39