diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java index d07c109dfa7..71ce11b6b17 100755 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/src/main/java/org/wso2/carbon/certificate/mgt/core/impl/CertificateGenerator.java @@ -427,7 +427,10 @@ public class CertificateGenerator { Date validityBeginDate = commonUtil.getValidityStartDate(); Date validityEndDate = commonUtil.getValidityEndDate(); - X500Name certSubject = new X500Name(CertificateManagementConstants.DEFAULT_PRINCIPAL); + X500Name certSubject = request.getSubject(); + if (certSubject == null) { //This is highly unlikely as the csr must have a subject name. + certSubject = new X500Name(CertificateManagementConstants.DEFAULT_PRINCIPAL); + } Attribute attributes[] = request.getAttributes(); RDN[] certUniqueIdRDN;