-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CertificateType attribute to CertificateRequest
- Loading branch information
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/venafi/vcert/sdk/certificate/CertificateType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.venafi.vcert.sdk.certificate; | ||
|
||
|
||
import lombok.Getter; | ||
|
||
public enum CertificateType { | ||
Auto("Auto"), | ||
CodeSigning("Code Signing: X.509 Code Signing Certificate"), | ||
Device("Device: X.509 Device Certificate"), | ||
Server("Server: X.509 Server Certificate"), | ||
User("User: X.509 User Certificate"); | ||
|
||
public static CertificateType from(String value) { | ||
switch (value.toLowerCase()) { | ||
case "auto": | ||
return Auto; | ||
case "code signing: x.509 code signing certificate": | ||
return CodeSigning; | ||
case "device: x.509 device certificate": | ||
return Device; | ||
case "server: x.509 server certificate": | ||
return Server; | ||
case "user: x.509 user certificate": | ||
return User; | ||
default: | ||
throw new IllegalArgumentException(String.format("unknown certificate type: %s", value)); | ||
} | ||
} | ||
|
||
@Getter | ||
private final String value; | ||
|
||
CertificateType(String value) { | ||
this.value = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters