KeyProtector, java.security.KeyStoreSpi , KeyTool
| Modifier and Type | Class and Description |
|---|---|
| public static class | |
| public static class | |
| public static class | |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final Debug | |
| private final Hashtable | entries
Private keys and certificates are stored in a hashtable. |
| private static final int | |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv abstract String | |
| private byte[] | |
| private void | |
| public Enumeration | Returns: enumeration of the alias namesImplements abstract java. Lists all the alias names of this keystore. |
| public boolean | Returns: true if the alias exists, false otherwisethe alias name alias)Implements abstract java. Checks if the given alias exists in this keystore. |
| public void | engineDeleteEntry(String
the alias name alias)Implements abstract java. Deletes the entry identified by the given alias from this keystore. |
| public Certificate | Returns: the certificate, or null if the given alias does not exist or does not contain a certificate.the alias name alias)Implements abstract java. Returns the certificate associated with the given alias. |
| public String | Returns: the (alias) name of the first entry with matching certificate, or null if no such entry exists in this keystore.the certificate to match with. cert)Implements abstract java. Returns the (alias) name of the first keystore entry whose certificate matches the given certificate. |
| public Certificate[] | Returns: the certificate chain (ordered with the user's certificate first and the root certificate authority last), or null if the given alias does not exist or does not contain a certificate chain (i.e., the given alias identifies either a trusted certificate entry or a key entry without a certificate chain).the alias name alias)Implements abstract java. Returns the certificate chain associated with the given alias. |
| public Date | Returns: the creation date of this entry, or null if the given alias does not existthe alias name alias)Implements abstract java. Returns the creation date of the entry identified by the given alias. |
| public Instant | Returns: the instant that the entry identified by the given alias was created, ornull if the given alias does not existthe alias name alias)Overrides java. Returns the instant that the entry identified by the given alias was created. |
| public Key | Returns: the requested key, or null if the given alias does not exist or does not identify a key entry.the alias name alias, char[] the password for recovering the key password)Implements abstract java. Returns the key associated with the given alias, using the given password to recover it. |
| public boolean | Returns: true if the entry identified by the given alias is a trusted certificate entry, false otherwise.Implements abstract java. Returns true if the entry identified by the given alias is a trusted certificate entry, and false otherwise. |
| public boolean | Returns: true if the entry identified by the given alias is a key entry, false otherwise.Implements abstract java. Returns true if the entry identified by the given alias is a key entry, and false otherwise. |
| public void | engineLoad(InputStream
the input stream from which the keystore is loaded stream, char[] the (optional) password used to check the integrity of
the keystore. password)Implements abstract java. Loads the keystore from the given input stream. |
| public void | engineSetCertificateEntry(String
the alias name alias, Certificate the certificate cert)Implements abstract java. Assigns the given certificate to the given alias. |
| public void | engineSetKeyEntry(String
the alias name alias, Key the private key to be associated with the alias key, char[] the password to protect the key password, Certificate[] the certificate chain for the corresponding public
key (only required if the given key is of type
chain)java.security.PrivateKey).Implements abstract java. Assigns the given private key to the given alias, protecting it with the given password as defined in PKCS8. |
| public void | engineSetKeyEntry(String
the alias name alias, byte[] the key (in protected format) to be associated with the alias key, Certificate[] the certificate chain for the corresponding public
key (only useful if the protected key is of type
chain)java.security.PrivateKey).Implements abstract java. Assigns the given key (that has already been protected) to the given alias. |
| public int | Returns: the number of entries in this keystoreImplements abstract java. Retrieves the number of entries in this keystore. |
| public void | engineStore(OutputStream
the output stream to which this keystore is written. stream, char[] the password to generate the keystore integrity check password)Implements abstract java. Stores this keystore to the given output stream, and protects its integrity with the given password. |
| private MessageDigest | getPreKeyedHash(char[] password)
To guard against tampering with the keystore, we append a keyed hash with a bit of extra data. |
| debug | back to summary |
|---|---|
| private static final Debug debug | |
| entries | back to summary |
|---|---|
| private final Hashtable<String, Object> entries Private keys and certificates are stored in a hashtable. Hash entries are keyed by alias names. | |
| MAGIC | back to summary |
|---|---|
| private static final int MAGIC | |
| VERSION_1 | back to summary |
|---|---|
| private static final int VERSION_1 | |
| VERSION_2 | back to summary |
|---|---|
| private static final int VERSION_2 | |
| JavaKeyStore | back to summary |
|---|---|
| pack-priv JavaKeyStore() | |
| convertAlias | back to summary |
|---|---|
| pack-priv abstract String convertAlias(String alias) | |
| convertToBytes | back to summary |
|---|---|
| private byte[] convertToBytes(char[] password) Helper method to convert char[] to byte[] | |
| emitWeakKeyStoreWarning | back to summary |
|---|---|
| private void emitWeakKeyStoreWarning() | |
| engineAliases | back to summary |
|---|---|
| public Enumeration Implements abstract java. Lists all the alias names of this keystore.
| |
| engineContainsAlias | back to summary |
|---|---|
| public boolean engineContainsAlias(String alias) Implements abstract java. Checks if the given alias exists in this keystore.
| |
| engineDeleteEntry | back to summary |
|---|---|
| public void engineDeleteEntry(String alias) throws KeyStoreException Implements abstract java. Deletes the entry identified by the given alias from this keystore.
| |
| engineGetCertificate | back to summary |
|---|---|
| public Certificate engineGetCertificate(String alias) Implements abstract java. Returns the certificate associated with the given alias. If the given alias name identifies a trusted certificate entry, the certificate associated with that entry is returned. If the given alias name identifies a key entry, the first element of the certificate chain of that entry is returned, or null if that entry does not have a certificate chain.
| |
| engineGetCertificateAlias | back to summary |
|---|---|
| public String engineGetCertificateAlias(Certificate cert) Implements abstract java. Returns the (alias) name of the first keystore entry whose certificate matches the given certificate. This method attempts to match the given certificate with each keystore entry. If the entry being considered is a trusted certificate entry, the given certificate is compared to that entry's certificate. If the entry being considered is a key entry, the given certificate is compared to the first element of that entry's certificate chain (if a chain exists).
| |
| engineGetCertificateChain | back to summary |
|---|---|
| public Certificate[] engineGetCertificateChain(String alias) Implements abstract java. Returns the certificate chain associated with the given alias.
| |
| engineGetCreationDate | back to summary |
|---|---|
| public Date engineGetCreationDate(String alias) Implements abstract java. Returns the creation date of the entry identified by the given alias. | |
| engineGetCreationInstant | back to summary |
|---|---|
| public Instant engineGetCreationInstant(String alias) Overrides java. Returns the instant that the entry identified by the given alias was created. | |
| engineGetKey | back to summary |
|---|---|
| public Key engineGetKey(String alias, char[] password) throws NoSuchAlgorithmException, UnrecoverableKeyException Implements abstract java. Returns the key associated with the given alias, using the given password to recover it.
| |
| engineIsCertificateEntry | back to summary |
|---|---|
| public boolean engineIsCertificateEntry(String alias) Implements abstract java. Returns true if the entry identified by the given alias is a trusted certificate entry, and false otherwise.
| |
| engineIsKeyEntry | back to summary |
|---|---|
| public boolean engineIsKeyEntry(String alias) Implements abstract java. Returns true if the entry identified by the given alias is a key entry, and false otherwise.
| |
| engineLoad | back to summary |
|---|---|
| public void engineLoad(InputStream stream, char[] password) throws IOException, NoSuchAlgorithmException, CertificateException Implements abstract java. Loads the keystore from the given input stream. If a password is given, it is used to check the integrity of the keystore data. Otherwise, the integrity of the keystore is not checked.
| |
| engineSetCertificateEntry | back to summary |
|---|---|
| public void engineSetCertificateEntry(String alias, Certificate cert) throws KeyStoreException Implements abstract java. Assigns the given certificate to the given alias. If the given alias already exists in this keystore and identifies a trusted certificate entry, the certificate associated with it is overridden by the given certificate.
| |
| engineSetKeyEntry | back to summary |
|---|---|
| public void engineSetKeyEntry(String alias, Key key, char[] password, Certificate[] chain) throws KeyStoreException Implements abstract java. Assigns the given private key to the given alias, protecting it with the given password as defined in PKCS8. The given java.security.PrivateKey If the given alias already exists, the keystore information associated with it is overridden by the given key and certificate chain.
| |
| engineSetKeyEntry | back to summary |
|---|---|
| public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain) throws KeyStoreException Implements abstract java. Assigns the given key (that has already been protected) to the given alias. If the protected key is of type
If the given alias already exists, the keystore information associated with it is overridden by the given key (and possibly certificate chain).
| |
| engineSize | back to summary |
|---|---|
| public int engineSize() Implements abstract java. Retrieves the number of entries in this keystore.
| |
| engineStore | back to summary |
|---|---|
| public void engineStore(OutputStream stream, char[] password) throws IOException, NoSuchAlgorithmException, CertificateException Implements abstract java. Stores this keystore to the given output stream, and protects its integrity with the given password.
| |
| getPreKeyedHash | back to summary |
|---|---|
| private MessageDigest getPreKeyedHash(char[] password) throws NoSuchAlgorithmException To guard against tampering with the keystore, we append a keyed hash with a bit of extra data. | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String |
| CaseExactJKS | back to summary |
|---|---|
| public CaseExactJKS() | |
| convertAlias | back to summary |
|---|---|
| pack-priv String convertAlias(String alias) Implements abstract sun. | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | engineProbe(InputStream stream)
Overrides sun. Probe the first few bytes of the keystore data stream for a valid JKS keystore encoding. |
| DualFormatJKS | back to summary |
|---|---|
| public DualFormatJKS() | |
| engineProbe | back to summary |
|---|---|
| public boolean engineProbe(InputStream stream) throws IOException Overrides sun. Probe the first few bytes of the keystore data stream for a valid JKS keystore encoding.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv String |
| JKS | back to summary |
|---|---|
| public JKS() | |
| convertAlias | back to summary |
|---|---|
| pack-priv String convertAlias(String alias) Implements abstract sun. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Certificate[] | |
| pack-priv Instant | |
| pack-priv byte[] |
| Access | Constructor and Description |
|---|---|
| private |
| chain | back to summary |
|---|---|
| pack-priv Certificate[] chain | |
| date | back to summary |
|---|---|
| pack-priv Instant date | |
| protectedPrivKey | back to summary |
|---|---|
| pack-priv byte[] protectedPrivKey | |
| KeyEntry | back to summary |
|---|---|
| private KeyEntry() | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Certificate | |
| pack-priv Instant |
| Access | Constructor and Description |
|---|---|
| private |
| cert | back to summary |
|---|---|
| pack-priv Certificate cert | |
| date | back to summary |
|---|---|
| pack-priv Instant date | |
| TrustedCertEntry | back to summary |
|---|---|
| private TrustedCertEntry() | |