|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tsik.xmlsig.tools.Pkcs12Import
Pkcs12Import contains a simple static function and command line interpreter for importing a PKCS12 certificate file into a Java KeyStore.
pkcs12Import(java.io.File, char[], java.lang.String, java.io.File, char[], char[])
,
usage()
Field Summary | |
---|---|
static File |
DEFAULT_KEYSTORE
The default keystore is defined as the ".keystore" file in the user's home directory. |
Constructor Summary | |
---|---|
Pkcs12Import()
|
Method Summary | |
---|---|
static void |
main(String[] argv)
Execute command as described by usage() . |
static void |
pkcs12Import(File pkcs12File,
char[] pkcs12Password,
String keyStoreAlias,
File keyStoreFile,
char[] storePassword,
char[] keyPassword)
Execute command as described by usage() . |
static void |
pkcs12Import(File pkcs12File,
char[] pkcs12Password,
String keyStoreAlias,
File keyStoreFile,
char[] storePassword,
char[] keyPassword,
String keyStoreType)
Execute command as described by usage() . |
static void |
usage()
Print the usage command and exit. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final File DEFAULT_KEYSTORE
Constructor Detail |
public Pkcs12Import()
Method Detail |
public static void main(String[] argv)
usage()
.
argv
- is the command argument array.public static void usage()
java Pkcs12Import -file pkcs12-file # pkcs12 file to be imported [ -pass pkcs12-password ] # user is prompted if omitted [ -alias alias ] # defaults to pkcs12 alias [ -keystore keystore-file ] # defaults to {user-home}/.keystore [ -storepass store-password ] # user is prompted if omitted [- keystoretype type ] # defaults to the default keystore type [ -keypass key-password ] # user is prompted if omitted and may # hit return to use store-password
public static void pkcs12Import(File pkcs12File, char[] pkcs12Password, String keyStoreAlias, File keyStoreFile, char[] storePassword, char[] keyPassword) throws IllegalArgumentException, IOException, GeneralSecurityException
usage()
. Assumes the keystore
is of the default keystore type,
as defined by KeyStore.getDefaultType()
pkcs12File
- is the exported PKCS12 certificate file.pkcs12Password
- is the password used to encrypt the PKCS12 file
when it was exported.keyStoreAlias
- is the alias used to store the imported cert, or
null to use the alias stored in the pkcs12File. It is recommended that
the pkcs12 alias be overridden since, at least when exported from IE,
it is a UUID and is not appropriate for a keystore alias.keyStoreFile
- is the KeyStore file where the imported cert is
to be saved, or null to use the default Java KeyStore.storePassword
- is the password used to open and save the java
KeyStore.keyPassword
- is the password used to protect the imported key.
IllegalArgumentException
- if the PKCS12 file contains zero or
more than one cert, or if the entry it contains cannot be recognized.
IOException
- if a problem reading or writing the KeyStore files
occurs.
GeneralSecurityException
- if a security related problem occurs
while accessing the KeyStores. This includes problems obtaining a
PKCS12 keystore provider or other security algorithms that are needed.public static void pkcs12Import(File pkcs12File, char[] pkcs12Password, String keyStoreAlias, File keyStoreFile, char[] storePassword, char[] keyPassword, String keyStoreType) throws IllegalArgumentException, IOException, GeneralSecurityException
usage()
.
See pkcs12Import(File, char[], String, File, char[], char[])
for more information.
This mathod adds parameter keyStoreType.
pkcs12File
- TODO.pkcs12Password
- TODO.keyStoreAlias
- TODO.keyStoreFile
- TODO.storePassword
- TODO.keyPassword
- TODO.keyStoreType
- the keystore type of keyStoreFile.
IllegalArgumentException
- TODO.
IOException
- TODO.
GeneralSecurityException
- TODO.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |