|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ImportKey
public class ImportKey
ImportKey.java
This class imports a key and a certificate into a keystore
($home/keystore.ImportKey
). If the keystore is
already present, it is simply deleted. Both the key and the
certificate file must be in DER
-format. The key must be
encoded with PKCS#8
-format. The certificate must be
encoded in X.509
-format.
Key format:
openssl pkcs8 -topk8 -nocrypt -in YOUR.KEY -out YOUR.KEY.der
-outform der
Format of the certificate:
openssl x509 -in YOUR.CERT -out YOUR.CERT.der -outform
der
Import key and certificate:
java comu.ImportKey YOUR.KEY.der YOUR.CERT.der
Caution: the old keystore.ImportKey
-file is
deleted and replaced with a keystore only containing YOUR.KEY
and YOUR.CERT
. The keystore and the key has no password;
they can be set by the keytool -keypasswd
-command for setting
the key password, and the keytool -storepasswd
-command to set
the keystore password.
The key and the certificate is stored under the alias
importkey
; to change this, use keytool -keyclone
.
Created: Fri Apr 13 18:15:07 2001
Updated: Fri Apr 19 11:03:00 2002
Constructor Summary | |
---|---|
ImportKey()
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
Takes two file names for a key and the certificate for the key, and imports those into a keystore. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ImportKey()
Method Detail |
---|
public static void main(java.lang.String[] args)
Takes two file names for a key and the certificate for the key, and imports those into a keystore. Optionally it takes an alias for the key.
The first argument is the filename for the key. The key should be in PKCS8-format.
The second argument is the filename for the certificate for the key.
If a third argument is given it is used as the alias. If missing, the key is imported with the alias importkey
The name of the keystore file can be controlled by setting
the keystore property (java -Dkeystore=mykeystore). If no name
is given, the file is named keystore.ImportKey
and placed in your home directory.
args
- [0] Name of the key file, [1] Name of the certificate file
[2] Alias for the key.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |