Skip to content

Commit 05a2c88

Browse files
Pom updated for mvn
1 parent 197bc09 commit 05a2c88

File tree

3 files changed

+109
-17
lines changed

3 files changed

+109
-17
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@
2323
hs_err_pid*
2424

2525
.idea/
26-
*.iml
26+
*.iml
27+
target/

pom.xml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,49 @@
66

77
<groupId>org.example</groupId>
88
<artifactId>certdog-java</artifactId>
9+
<packaging>jar</packaging>
910
<version>1.0</version>
1011

12+
<name>certdog-java-client</name>
13+
<description>
14+
The java client that can be incorporated into java applications to interface with certdog
15+
This enables the automatic issuance of certificates from local CAs, Microsoft CAs or EJBCAs
16+
</description>
17+
<url>https://krestfield.com/certdog</url>
18+
19+
<licenses>
20+
<license>
21+
<name>3-Clause BSD License</name>
22+
<url>https://opensource.org/licenses/BSD-3-Clause</url>
23+
<distribution>repo</distribution>
24+
</license>
25+
</licenses>
26+
27+
<developers>
28+
<developer>
29+
<organization>Krestfield Limited</organization>
30+
<organizationUrl>https://krestfield.com</organizationUrl>
31+
<timezone>Europe/London</timezone>
32+
</developer>
33+
</developers>
34+
1135
<properties>
1236
<maven.compiler.source>8</maven.compiler.source>
1337
<maven.compiler.target>8</maven.compiler.target>
38+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1439
</properties>
1540

41+
<distributionManagement>
42+
<snapshotRepository>
43+
<id>ossrh</id>
44+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
45+
</snapshotRepository>
46+
<repository>
47+
<id>ossrh</id>
48+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
49+
</repository>
50+
</distributionManagement>
51+
1652
<build>
1753
<finalName>${project.name}-${project.version}</finalName>
1854
<plugins>
@@ -29,9 +65,53 @@
2965
-->
3066
</configuration>
3167
</plugin>
68+
<plugin>
69+
<groupId>org.apache.maven.plugins</groupId>
70+
<artifactId>maven-gpg-plugin</artifactId>
71+
<version>1.5</version>
72+
<executions>
73+
<execution>
74+
<id>sign-artifacts</id>
75+
<phase>verify</phase>
76+
<goals>
77+
<goal>sign</goal>
78+
</goals>
79+
</execution>
80+
</executions>
81+
</plugin>
82+
<plugin>
83+
<groupId>org.apache.maven.plugins</groupId>
84+
<artifactId>maven-javadoc-plugin</artifactId>
85+
<version>3.2.0</version>
86+
<executions>
87+
<execution>
88+
<id>attach-javadocs</id>
89+
<goals>
90+
<goal>jar</goal>
91+
</goals>
92+
</execution>
93+
</executions>
94+
</plugin>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-source-plugin</artifactId>
98+
<version>3.2.1</version>
99+
<executions>
100+
<execution>
101+
<id>attach-sources</id>
102+
<goals>
103+
<goal>jar</goal>
104+
</goals>
105+
</execution>
106+
</executions>
107+
</plugin>
32108
</plugins>
33109
</build>
34110

111+
<scm>
112+
<url>https://github.com/krestfield/certdog-java-client</url>
113+
</scm>
114+
35115
<dependencies>
36116
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client -->
37117
<dependency>

src/main/java/com/krestfield/certdog/client/CertdogClient.java

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)