Merge pull request #160 from hasuniea/master

Refactored certificateGenerator
merge-requests/7/head
Prabath Abeysekara 9 years ago
commit a6905b52b1

@ -53,7 +53,6 @@ import org.wso2.carbon.certificate.mgt.core.dao.CertificateManagementDAOExceptio
import org.wso2.carbon.certificate.mgt.core.dao.CertificateManagementDAOFactory; import org.wso2.carbon.certificate.mgt.core.dao.CertificateManagementDAOFactory;
import org.wso2.carbon.certificate.mgt.core.dto.CAStatus; import org.wso2.carbon.certificate.mgt.core.dto.CAStatus;
import org.wso2.carbon.certificate.mgt.core.dto.SCEPResponse; import org.wso2.carbon.certificate.mgt.core.dto.SCEPResponse;
import org.wso2.carbon.certificate.mgt.core.exception.CertificateManagementException;
import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException;
import org.wso2.carbon.certificate.mgt.core.util.CommonUtil; import org.wso2.carbon.certificate.mgt.core.util.CommonUtil;
import org.wso2.carbon.certificate.mgt.core.util.ConfigurationUtil; import org.wso2.carbon.certificate.mgt.core.util.ConfigurationUtil;
@ -594,7 +593,8 @@ public class CertificateGenerator {
} }
/** /**
* Get Signed certificate by parsing certificate. * This method is used to retrieve signed certificate from certificate signing request.
*
* @param binarySecurityToken CSR that comes from the client as a String value.It is base 64 encoded request * @param binarySecurityToken CSR that comes from the client as a String value.It is base 64 encoded request
* security token. * security token.
* @return Return signed certificate in X508Certificate type object. * @return Return signed certificate in X508Certificate type object.
@ -611,9 +611,7 @@ public class CertificateGenerator {
try { try {
certificationRequest = new PKCS10CertificationRequest(byteArrayBst); certificationRequest = new PKCS10CertificationRequest(byteArrayBst);
} catch (IOException e) { } catch (IOException e) {
String msg = "CSR cannot be recovered."; throw new KeystoreException("CSR cannot be recovered.", e);
log.error(msg, e);
throw new KeystoreException(msg, e);
} }
X509Certificate signedCertificate = generateCertificateFromCSR(privateKeyCA, certificationRequest, X509Certificate signedCertificate = generateCertificateFromCSR(privateKeyCA, certificationRequest,
certCA.getIssuerX500Principal().getName()); certCA.getIssuerX500Principal().getName());

Loading…
Cancel
Save