Skip to content

Commit

Permalink
Replace CertUtils.getCertificateUsage() with CertUtil.toCertificateUs…
Browse files Browse the repository at this point in the history
…age()
  • Loading branch information
edewata committed May 8, 2023
1 parent b4a37a8 commit 3c4b8d5
Showing 1 changed file with 1 addition and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ public static void verifySystemCertValidityByNickname(String nickname) throws Ex
*/
public static void verifySystemCertByNickname(String nickname, String certusage) throws Exception {
logger.debug("CertUtils: verifySystemCertByNickname(" + nickname + ", " + certusage + ")");
CertificateUsage cu = getCertificateUsage(certusage);
CertificateUsage cu = CertUtil.toCertificateUsage(certusage);
int ccu = 0;

if (cu == null) {
Expand Down Expand Up @@ -921,43 +921,6 @@ public static void verifySystemCertByNickname(String nickname, String certusage)
}
}

/*
* returns CertificateUsage mapping to JSS
*/
public static CertificateUsage getCertificateUsage(String certusage) {
CertificateUsage cu = null;
if ((certusage == null) || certusage.equals(""))
cu = CertificateUsage.CheckAllUsages;
else if (certusage.equalsIgnoreCase("CheckAllUsages"))
cu = CertificateUsage.CheckAllUsages;
else if (certusage.equalsIgnoreCase("SSLServer"))
cu = CertificateUsage.SSLServer;
else if (certusage.equalsIgnoreCase("SSLServerWithStepUp"))
cu = CertificateUsage.SSLServerWithStepUp;
else if (certusage.equalsIgnoreCase("SSLClient"))
cu = CertificateUsage.SSLClient;
else if (certusage.equalsIgnoreCase("SSLCA"))
cu = CertificateUsage.SSLCA;
else if (certusage.equalsIgnoreCase("AnyCA"))
cu = CertificateUsage.AnyCA;
else if (certusage.equalsIgnoreCase("StatusResponder"))
cu = CertificateUsage.StatusResponder;
else if (certusage.equalsIgnoreCase("ObjectSigner"))
cu = CertificateUsage.ObjectSigner;
else if (certusage.equalsIgnoreCase("UserCertImport"))
cu = CertificateUsage.UserCertImport;
else if (certusage.equalsIgnoreCase("ProtectedObjectSigner"))
cu = CertificateUsage.ProtectedObjectSigner;
else if (certusage.equalsIgnoreCase("VerifyCA"))
cu = CertificateUsage.VerifyCA;
else if (certusage.equalsIgnoreCase("EmailSigner"))
cu = CertificateUsage.EmailSigner;
else if (certusage.equalsIgnoreCase("EmailRecipient"))
cu = CertificateUsage.EmailRecipient;

return cu;
}

/*
* addCTpoisonExt adds the Certificate Transparency V1 poison extension
* to the Ceritificate Info
Expand Down

0 comments on commit 3c4b8d5

Please sign in to comment.