KeyPairResourceWriter for writing keys in the modern OpenSSH format, using the OpenBSD bcrypt KDF for
passphrase-protected encrypted private keys.
| Modifier and Type | Class and Description |
|---|---|
| public static class | OpenSSHKeyPairResourceWriter.
A key encryptor for modern-style OpenSSH private keys using the bcrypt KDF. |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | |
| public static final OpenSSHKeyPairResourceWriter | |
| public static final int | |
| private static final Pattern |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static OpenSSHKeyEncryptionContext | |
| public static byte[] | |
| public static byte[] | |
| public static String | |
| public static void | |
| public static void | |
| public void | writePrivateKey(KeyPair
to write the private key of key, String to write with the private key comment, OpenSSHKeyEncryptionContext for writing the key; may be options, OutputStream null if no encryption is wanted. The caller
is responsible for clearing the options when no longer needed. If the passphrase
obtained from the context is null or an empty/blank string (length zero
or containing only whitespace), the key is written unencrypted.The out)OutputStream to write to - recommend using a
SecureByteArrayOutputStream in order to reduce sensitive data exposure
in memoryImplements org. Writes a serialization of a private key from a given |
| public void | writePublicKey(PublicKey
to write key, String to write with the key comment, OutputStream The out)OutputStream to write to - recommend using a
SecureByteArrayOutputStream in order to reduce sensitive data exposure
in memoryImplements org. Writes a serialization of a |
| DASHES | back to summary |
|---|---|
| public static final String DASHES | |
| INSTANCE | back to summary |
|---|---|
| public static final OpenSSHKeyPairResourceWriter INSTANCE | |
| LINE_LENGTH | back to summary |
|---|---|
| public static final int LINE_LENGTH | |
| VERTICALSPACE | back to summary |
|---|---|
| private static final Pattern VERTICALSPACE | |
| OpenSSHKeyPairResourceWriter | back to summary |
|---|---|
| public OpenSSHKeyPairResourceWriter() | |
| determineEncryption | back to summary |
|---|---|
| public static OpenSSHKeyEncryptionContext determineEncryption(OpenSSHKeyEncryptionContext options) | |
| encodePrivateKey | back to summary |
|---|---|
| public static byte[] encodePrivateKey(KeyPair key, String keyType, int blockSize, String comment) throws IOException, GeneralSecurityException | |
| encodePublicKey | back to summary |
|---|---|
| public static byte[] encodePublicKey(PublicKey key, String keyType) throws IOException, GeneralSecurityException | |
| firstLine | back to summary |
|---|---|
| public static String firstLine(String text) | |
| write | back to summary |
|---|---|
| public static void write(OutputStream out, byte[] bytes, int lineLength) throws IOException | |
| write | back to summary |
|---|---|
| public static void write(OutputStream out, String s) throws IOException | |
| writePrivateKey | back to summary |
|---|---|
| public void writePrivateKey(KeyPair key, String comment, OpenSSHKeyEncryptionContext options, OutputStream out) throws IOException, GeneralSecurityException Implements org. Doc from org. Writes a serialization of a private key from a given
| |
| writePublicKey | back to summary |
|---|---|
| public void writePublicKey(PublicKey key, String comment, OutputStream out) throws IOException, GeneralSecurityException Implements org. Doc from org. Writes a serialization of a
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| private byte[] | |
| protected final OpenSSHKeyEncryptionContext |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected byte[] | |
| protected byte[] | Returns: keyLength bytes to use as encryption keyfor the encryption, provides the passphrase and transports other encryption-related
information including the IV context, int number of key bytes to generate keyLength)Overrides org. Derives an encryption key and set the IV on the |
| public byte[] |
| BCRYPT_SALT_LENGTH | back to summary |
|---|---|
| public static final int BCRYPT_SALT_LENGTH | |
| kdfOptions | back to summary |
|---|---|
| private byte[] kdfOptions | |
| options | back to summary |
|---|---|
| protected final OpenSSHKeyEncryptionContext options | |
| KeyEncryptor | back to summary |
|---|---|
| public KeyEncryptor(OpenSSHKeyEncryptionContext options) | |
| convert | back to summary |
|---|---|
| protected byte[] convert(String password) | |
| deriveEncryptionKey | back to summary |
|---|---|
| protected byte[] deriveEncryptionKey(PrivateKeyEncryptionContext context, int keyLength) throws IOException, GeneralSecurityException Overrides org. Derives an encryption key and set the IV on the
| |
| getKdfOptions | back to summary |
|---|---|
| public byte[] getKdfOptions() Retrieves the KDF options used. Valid only after
| |