@@ -88,6 +88,7 @@ public enum RevocationReason
8888 }
8989 }
9090
91+ // Mappings between the revocation name and ID
9192 HashMap <Integer , String > revokeReasons = new HashMap <Integer , String >(){{
9293 put (RevocationReason .Unspecified .value , "unspecified" );
9394 put (RevocationReason .KeyCompromise .value , "key compromise" );
@@ -98,6 +99,7 @@ public enum RevocationReason
9899 put (RevocationReason .Hold .value , "hold" );
99100 }};
100101
102+ // Possible return formats for the certificate
101103 public enum ResponseFormat
102104 {
103105 PKCS12 ,
@@ -150,7 +152,7 @@ public void login(String username, String password) throws CertdogException
150152 /**
151153 * Logout of the certdog API
152154 *
153- * @throws CertdogException
155+ * @throws CertdogException if logout fails
154156 */
155157 public void logout () throws CertdogException
156158 {
@@ -172,8 +174,8 @@ public void logout() throws CertdogException
172174 * Returns a list of teams that the current logged in user
173175 * is a member of
174176 *
175- * @return
176- * @throws CertdogException
177+ * @return an array of the team names
178+ * @throws CertdogException if there is an error obtaining
177179 */
178180 public List <String > getTeams () throws CertdogException
179181 {
@@ -195,8 +197,8 @@ public List<String> getTeams() throws CertdogException
195197 * Returns a list of issuer names that the current logged in user
196198 * has permissions to request certificates from
197199 *
198- * @return
199- * @throws CertdogException
200+ * @return an array of the issuer names
201+ * @throws CertdogException if there is an error obtaining
200202 */
201203 public List <String > getIssuers () throws CertdogException
202204 {
@@ -216,8 +218,8 @@ public List<String> getIssuers() throws CertdogException
216218 * Returns a list of CSR generators that can be referenced when
217219 * requesting a certificate
218220 *
219- * @return
220- * @throws CertdogException
221+ * @return an array of the generator names
222+ * @throws CertdogException if there is an error obtaining
221223 */
222224 public List <String > getGenerators () throws CertdogException
223225 {
@@ -250,7 +252,7 @@ public List<String> getGenerators() throws CertdogException
250252 * @param extraEmails Additional emails to send renewal reminders and issue emails
251253 * @param format The return format - PKCS12/JKS or PEM
252254 * @return the PKCS12/PFX data, base64 encoded. Use SaveP12 to save to a PFX/P12 file for import
253- * @throws CertdogException
255+ * @throws CertdogException if there is an error obtaining the cert
254256 */
255257 public String requestCert (String issuerName , String generatorName , String teamName ,
256258 String dn , String password , List <String > sans ,
@@ -313,7 +315,7 @@ public String requestCert(String issuerName, String generatorName, String teamNa
313315 * @param extraInfo Any extra free text to be associated with the certificate
314316 * @param extraEmails Additional emails to send renewal reminders and issue emails
315317 * @return An X509Certificate
316- * @throws CertdogException
318+ * @throws CertdogException if there is an error obtaining the cert
317319 */
318320 public X509Certificate requestCertFromCsr (String issuerName , String teamName , String csrData ,
319321 String extraInfo , List <String > extraEmails ) throws CertdogException
@@ -344,6 +346,13 @@ public X509Certificate requestCertFromCsr(String issuerName, String teamName, St
344346 }
345347 }
346348
349+ /**
350+ * Gets the cert chain for the cert issuer
351+ *
352+ * @param issuerName the name of the cert issuer
353+ * @return an array of X509Certificate - intermediate and root CAs
354+ * @throws CertdogException if there is an error obtaining the certificates
355+ */
347356 public List <X509Certificate > getIssuerChain (String issuerName ) throws CertdogException
348357 {
349358 String path = String .format (CertdogEndpoints .ISSUER_CHAIN , issuerName );
@@ -369,7 +378,7 @@ public List<X509Certificate> getIssuerChain(String issuerName) throws CertdogExc
369378 * @param issuerName the cert issuer name - must be the same as the cert was issued from
370379 * @param cert the certificate
371380 * @param reason the revocation reason
372- * @throws CertdogException
381+ * @throws CertdogException if there is an error revoking
373382 */
374383 public void revokeCert (String issuerName , X509Certificate cert , RevocationReason reason ) throws CertdogException
375384 {
@@ -382,7 +391,7 @@ public void revokeCert(String issuerName, X509Certificate cert, RevocationReason
382391 * @param issuerName the cert issuer name - must be the same as the cert was issued from
383392 * @param serialNumber the serial number in ASCII HEX format
384393 * @param reason the revocation reason
385- * @throws CertdogException
394+ * @throws CertdogException if there is an error revoking
386395 */
387396 public void revokeCert (String issuerName , String serialNumber , RevocationReason reason ) throws CertdogException
388397 {
@@ -420,7 +429,7 @@ public void revokeCert(String issuerName, String serialNumber, RevocationReason
420429 *
421430 * @param p12B64Data the base64 p12/pfx data
422431 * @param filename the filename to save the data
423- * @throws CertdogException
432+ * @throws CertdogException if there is an error saving
424433 */
425434 public static void SaveP12 (String p12B64Data , String filename ) throws CertdogException
426435 {
@@ -441,7 +450,7 @@ public static void SaveP12(String p12B64Data, String filename) throws CertdogExc
441450 *
442451 * @param jksB64Data the base64 encoded JKS data
443452 * @param filename the filename to save the data
444- * @throws CertdogException
453+ * @throws CertdogException if there is an error saving
445454 */
446455 public static void SaveJks (String jksB64Data , String filename ) throws CertdogException
447456 {
@@ -453,7 +462,7 @@ public static void SaveJks(String jksB64Data, String filename) throws CertdogExc
453462 *
454463 * @param pemData the PEM data
455464 * @param filename the filename to save the data
456- * @throws CertdogException
465+ * @throws CertdogException if there is an error saving
457466 */
458467 public static void SavePem (String pemData , String filename ) throws CertdogException
459468 {
@@ -472,7 +481,7 @@ public static void SavePem(String pemData, String filename) throws CertdogExcept
472481 *
473482 * @param cert the certificate to save
474483 * @param filename the filename to save the data
475- * @throws CertdogException
484+ * @throws CertdogException if there is an error saving
476485 */
477486 public static void SaveCert (X509Certificate cert , String filename ) throws CertdogException
478487 {
@@ -498,7 +507,7 @@ public static void SaveCert(X509Certificate cert, String filename) throws Certdo
498507 *
499508 * @param certData The cert data
500509 * @return A certificate object
501- * @throws CertdogException
510+ * @throws CertdogException if there is an encoding error
502511 */
503512 private static X509Certificate GetCertFromData (String certData ) throws CertdogException
504513 {
@@ -522,3 +531,5 @@ private static X509Certificate GetCertFromData(String certData) throws CertdogEx
522531 }
523532 }
524533}
534+ /********************************************* END OF FILE *****************************************************
535+ ***************************************************************************************************************/
0 commit comments