|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcc.security.KeyStoreUtil
public class KeyStoreUtil
Simple utility for managing common KeyStore tasks.
| Field Summary | |
|---|---|
private static java.lang.String |
endLine
|
| Constructor Summary | |
|---|---|
KeyStoreUtil()
|
|
| Method Summary | |
|---|---|
static void |
appendHexValue(java.lang.StringBuffer buffer,
byte b)
Helper method that converts a single byte to a hex string representation. |
static void |
appendHexValue(java.lang.StringBuffer buffer,
byte[] bytes)
Helper that appends a hex representation of a byte array to an existing StringBuffer. |
static java.util.List |
getAliases(java.security.KeyStore keystore)
List all the key and certificate aliases in the keystore. |
static java.security.cert.Certificate |
getCertificate(java.security.KeyStore keystore,
java.lang.String alias)
Get a certificate from the keystore by name. |
static java.security.Key |
getKey(java.security.KeyStore keystore,
java.lang.String alias,
java.lang.String password)
Get a private key from the keystore by name and password. |
static java.security.KeyStore |
getKeyStore(java.io.InputStream in,
java.lang.String password)
Get a KeyStore object given the keystore filename and password. |
static java.security.KeyStore |
getKeyStore(java.lang.String filename,
java.lang.String password)
Get a KeyStore object given the keystore filename and password. |
static java.lang.String |
getUserInput(java.lang.String prompt)
Helper method to solicit a line of user input from the console. |
static void |
main(java.lang.String[] args)
As an application, this class will operate something like the keytool -list command: it will read out every alias in the keystore, and with the user's provided password for a given key will write out all data on the key and/or certificate. |
static java.lang.String |
spillBeans(java.security.cert.Certificate cert)
Dump all data about the certificate to the console. |
static java.lang.String |
spillBeans(java.security.Key key)
Dump all data about the private key to the console. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String endLine
| Constructor Detail |
|---|
public KeyStoreUtil()
| Method Detail |
|---|
public static java.security.KeyStore getKeyStore(java.lang.String filename,
java.lang.String password)
throws java.security.KeyStoreException
java.security.KeyStoreException
public static java.security.KeyStore getKeyStore(java.io.InputStream in,
java.lang.String password)
throws java.security.KeyStoreException
java.security.KeyStoreException
public static java.util.List getAliases(java.security.KeyStore keystore)
throws java.security.KeyStoreException
java.security.KeyStoreException
public static java.security.Key getKey(java.security.KeyStore keystore,
java.lang.String alias,
java.lang.String password)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public static java.security.cert.Certificate getCertificate(java.security.KeyStore keystore,
java.lang.String alias)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic static java.lang.String spillBeans(java.security.Key key)
public static java.lang.String spillBeans(java.security.cert.Certificate cert)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public static java.lang.String getUserInput(java.lang.String prompt)
throws java.io.IOException
java.io.IOException
public static void appendHexValue(java.lang.StringBuffer buffer,
byte b)
b - byte Byte to convert
public static void appendHexValue(java.lang.StringBuffer buffer,
byte[] bytes)
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||