Class AbstractPrivateKeyObfuscator
- java.lang.Object
-
- org.apache.sshd.common.config.keys.loader.AbstractPrivateKeyObfuscator
-
- All Implemented Interfaces:
PrivateKeyObfuscator
- Direct Known Subclasses:
AESPrivateKeyObfuscator
,DESPrivateKeyObfuscator
public abstract class AbstractPrivateKeyObfuscator extends java.lang.Object implements PrivateKeyObfuscator
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
algName
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractPrivateKeyObfuscator(java.lang.String name)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <A extends java.lang.Appendable>
AappendPrivateKeyEncryptionContext(A sb, PrivateKeyEncryptionContext encContext)
protected byte[]
applyPrivateKeyCipher(byte[] bytes, PrivateKeyEncryptionContext encContext, int numBits, byte[] keyValue, boolean encryptIt)
protected byte[]
deriveEncryptionKey(PrivateKeyEncryptionContext encContext, int outputKeyLength)
byte[]
generateInitializationVector(PrivateKeyEncryptionContext encContext)
java.lang.String
getCipherName()
protected abstract int
resolveInitializationVectorLength(PrivateKeyEncryptionContext encContext)
protected abstract int
resolveKeyLength(PrivateKeyEncryptionContext encContext)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.config.keys.loader.PrivateKeyObfuscator
applyPrivateKeyCipher, getSupportedKeySizes
-
-
-
-
Method Detail
-
getCipherName
public final java.lang.String getCipherName()
- Specified by:
getCipherName
in interfacePrivateKeyObfuscator
- Returns:
- Basic cipher used to obfuscate
-
generateInitializationVector
public byte[] generateInitializationVector(PrivateKeyEncryptionContext encContext) throws java.security.GeneralSecurityException
- Specified by:
generateInitializationVector
in interfacePrivateKeyObfuscator
- Parameters:
encContext
- The encryption context- Returns:
- An initialization vector suitable to the specified context
- Throws:
java.security.GeneralSecurityException
-
appendPrivateKeyEncryptionContext
public <A extends java.lang.Appendable> A appendPrivateKeyEncryptionContext(A sb, PrivateKeyEncryptionContext encContext) throws java.io.IOException
- Specified by:
appendPrivateKeyEncryptionContext
in interfacePrivateKeyObfuscator
- Type Parameters:
A
- Appendable generic type- Parameters:
sb
- TheAppendable
instance to update- Returns:
- Same appendable instance
- Throws:
java.io.IOException
-
resolveInitializationVectorLength
protected abstract int resolveInitializationVectorLength(PrivateKeyEncryptionContext encContext) throws java.security.GeneralSecurityException
- Throws:
java.security.GeneralSecurityException
-
resolveKeyLength
protected abstract int resolveKeyLength(PrivateKeyEncryptionContext encContext) throws java.security.GeneralSecurityException
- Throws:
java.security.GeneralSecurityException
-
deriveEncryptionKey
protected byte[] deriveEncryptionKey(PrivateKeyEncryptionContext encContext, int outputKeyLength) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
applyPrivateKeyCipher
protected byte[] applyPrivateKeyCipher(byte[] bytes, PrivateKeyEncryptionContext encContext, int numBits, byte[] keyValue, boolean encryptIt) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
-