Top Inners Fields Constructors Methods
org.apache.sshd.common.config.keys.loader

public Class AESPrivateKeyObfuscator

extends AbstractPrivateKeyObfuscator
Class Inheritance
Known Direct Subclasses
org.apache.sshd.common.config.keys.writer.openssh.OpenSSHKeyPairResourceWriter.KeyEncryptor
Imports
java.io.IOException, java.security.GeneralSecurityException, .Key, .NoSuchAlgorithmException, java.security.spec.InvalidKeySpecException, java.util.ArrayList, .Collections, .List, java.util.function.Predicate, javax.crypto.Cipher, javax.crypto.spec.SecretKeySpec, org.apache.sshd.common.cipher.BuiltinCiphers, .CipherInformation, org.apache.sshd.common.util.security.SecurityUtils

Author
Apache MINA SSHD Project

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
public static final String
public static final AESPrivateKeyObfuscator

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public byte[]
applyPrivateKeyCipher(byte[]
Original bytes
bytes
,
PrivateKeyEncryptionContext
The encryption context
encContext
,
boolean
If true then encrypt the original bytes, otherwise decrypt them
encryptIt
)

Implements org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.applyPrivateKeyCipher.

public static Predicate<CipherInformation>
createCipherSelector(int keyLength, String cipherMode)

public static List<Integer>

Returns:

A List of Integers holding the available key lengths values (in bits) for the JVM

Note

AES 256 requires special JCE policy extension installation (e.g., for Java 7 see this link)

getAvailableKeyLengths
()

public List<Integer>
protected CipherInformation
resolveCipherInformation(int keyLength, String cipherMode)

protected int
protected int
Inherited from org.apache.sshd.common.config.keys.loader.AbstractPrivateKeyObfuscator:
appendPrivateKeyEncryptionContextapplyPrivateKeyCipherderiveEncryptionKeygenerateInitializationVectorgetCipherName

Field Detail

CIPHER_NAMEback to summary
public static final String CIPHER_NAME
INSTANCEback to summary
public static final AESPrivateKeyObfuscator INSTANCE

Constructor Detail

AESPrivateKeyObfuscatorback to summary
public AESPrivateKeyObfuscator()

Method Detail

applyPrivateKeyCipherback to summary
public byte[] applyPrivateKeyCipher(byte[] bytes, PrivateKeyEncryptionContext encContext, boolean encryptIt) throws GeneralSecurityException, IOException

Implements org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.applyPrivateKeyCipher.

Parameters
bytes:byte[]

Doc from org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.applyPrivateKeyCipher.

Original bytes

encContext:PrivateKeyEncryptionContext

Doc from org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.applyPrivateKeyCipher.

The encryption context

encryptIt:boolean

Doc from org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.applyPrivateKeyCipher.

If true then encrypt the original bytes, otherwise decrypt them

Returns:byte[]

Doc from org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.applyPrivateKeyCipher.

The result of applying the cipher to the original bytes

Annotations
@Override
Exceptions
GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.applyPrivateKeyCipher.

If cannot encrypt/decrypt

IOException:

Doc from org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.applyPrivateKeyCipher.

If malformed input

createCipherSelectorback to summary
public static Predicate<CipherInformation> createCipherSelector(int keyLength, String cipherMode)
getAvailableKeyLengthsback to summary
public static List<Integer> getAvailableKeyLengths()
Returns:List<Integer>

A List of Integers holding the available key lengths values (in bits) for the JVM

Note

AES 256 requires special JCE policy extension installation (e.g., for Java 7 see this link)

Annotations
@SuppressWarnings:synthetic-access
getSupportedKeySizesback to summary
public List<Integer> getSupportedKeySizes()

Implements org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.getSupportedKeySizes.

Returns:List<Integer>

Doc from org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator.getSupportedKeySizes.

A List of the supported key sizes - Note: every call returns a and un-modifiable instance.

Annotations
@Override
resolveCipherInformationback to summary
protected CipherInformation resolveCipherInformation(int keyLength, String cipherMode)
resolveInitializationVectorLengthback to summary
protected int resolveInitializationVectorLength(PrivateKeyEncryptionContext encContext) throws GeneralSecurityException

Implements abstract org.apache.sshd.common.config.keys.loader.AbstractPrivateKeyObfuscator.resolveInitializationVectorLength.

Annotations
@Override
resolveKeyLengthback to summary
protected int resolveKeyLength(PrivateKeyEncryptionContext encContext) throws GeneralSecurityException

Implements abstract org.apache.sshd.common.config.keys.loader.AbstractPrivateKeyObfuscator.resolveKeyLength.

Annotations
@Override
org.apache.sshd.common.config.keys.loader back to summary

private final Class AESPrivateKeyObfuscator.LazyKeyLengthsHolder

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.sshd.common.config.keys.loader.AESPrivateKeyObfuscator.LazyKeyLengthsHolder

Field Summary

Modifier and TypeField and Description
private static final List<Integer>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static List<Integer>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

KEY_LENGTHSback to summary
private static final List<Integer> KEY_LENGTHS

Constructor Detail

LazyKeyLengthsHolderback to summary
private LazyKeyLengthsHolder()

Method Detail

detectSupportedKeySizesback to summary
private static List<Integer> detectSupportedKeySizes()