forked from jopenlibs/vault-java-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add PKCS8 support on format of private key when issue on pki (jopenli…
…bs#62) Co-authored-by: Grégoire Rolland <[email protected]> (cherry picked from commit 79c0578)
- Loading branch information
Showing
3 changed files
with
202 additions
and
10 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
29 changes: 29 additions & 0 deletions
29
src/main/java/io/github/jopenlibs/vault/api/pki/PrivateKeyFormat.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,29 @@ | ||
package io.github.jopenlibs.vault.api.pki; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* <p>Possible format options for private key issued by the PKI backend.</p> | ||
* | ||
* <p>See: {@link Pki#issue(String, String, List, List, String, CredentialFormat)}</p> | ||
*/ | ||
public enum PrivateKeyFormat { | ||
DER, | ||
PKCS8; | ||
|
||
public static PrivateKeyFormat fromString(final String text) { | ||
if (text != null) { | ||
for (final PrivateKeyFormat format : PrivateKeyFormat.values()) { | ||
if (text.equalsIgnoreCase(format.toString())) { | ||
return format; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return super.toString().toLowerCase(); | ||
} | ||
} |
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