Package org.apache.sshd.common.cipher
Enum BuiltinCiphers
- All Implemented Interfaces:
Serializable,Comparable<BuiltinCiphers>,Supplier<Cipher>,AlgorithmNameProvider,BuiltinFactory<Cipher>,CipherFactory,CipherInformation,Factory<Cipher>,KeySizeIndicator,NamedFactory<Cipher>,NamedResource,OptionalFeature
Provides easy access to the currently implemented ciphers
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic classHolds the result ofparseCiphersList(String) -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionDeprecated.Deprecated.Deprecated.Deprecated. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final intprivate final intprivate static final Map<String, CipherFactory> private final Stringprivate final intprivate final intprivate final intprivate final booleanprivate final Stringstatic final Set<BuiltinCiphers> Fields inherited from interface org.apache.sshd.common.NamedResource
BY_NAME_COMPARATOR, NAME_EXTRACTORFields inherited from interface org.apache.sshd.common.OptionalFeature
FALSE, TRUE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateBuiltinCiphers(String factoryName, int ivsize, int authSize, int kdfSize, String algorithm, int keySize, String transformation, int blkSize) -
Method Summary
Modifier and TypeMethodDescriptioncreate()static BuiltinCiphersfromFactory(NamedFactory<Cipher> factory) static BuiltinCiphersfromFactoryName(String name) static BuiltinCiphersfromString(String s) intintintintintfinal StringgetName()static NavigableSet<CipherFactory> booleanstatic BuiltinCiphers.ParseResultparseCiphersList(String ciphers) static BuiltinCiphers.ParseResultparseCiphersList(String... ciphers) static BuiltinCiphers.ParseResultparseCiphersList(Collection<String> ciphers) static voidregisterExtension(CipherFactory extension) Registered aNamedFactoryto be available besides the built-in ones when parsing configurationstatic CipherFactoryresolveFactory(String name) final StringtoString()static NamedFactory<Cipher> unregisterExtension(String name) Unregisters specified extensionstatic BuiltinCiphersReturns the enum constant of this type with the specified name.static BuiltinCiphers[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
none
-
aes128cbc
-
aes128ctr
-
aes128gcm
-
aes256gcm
-
aes192cbc
-
aes192ctr
-
aes256cbc
-
aes256ctr
-
arcfour128
Deprecated.- See Also:
-
arcfour256
Deprecated.- See Also:
-
blowfishcbc
Deprecated.- See Also:
-
cc20p1305_openssh
-
tripledescbc
Deprecated.- See Also:
-
-
Field Details
-
VALUES
-
EXTENSIONS
-
factoryName
-
ivsize
private final int ivsize -
authSize
private final int authSize -
kdfSize
private final int kdfSize -
keysize
private final int keysize -
blkSize
private final int blkSize -
algorithm
-
transformation
-
supported
private final boolean supported
-
-
Constructor Details
-
BuiltinCiphers
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getName
- Specified by:
getNamein interfaceNamedResource- Returns:
- The resource name
-
toString
- Overrides:
toStringin classEnum<BuiltinCiphers>
-
isSupported
public boolean isSupported()- Specified by:
isSupportedin interfaceOptionalFeature- Returns:
trueif the current JVM configuration supports this cipher - e.g., AES-256 requires the Java Cryptography Extension (JCE)
-
getKeySize
public int getKeySize()- Specified by:
getKeySizein interfaceKeySizeIndicator- Returns:
- The number of bits used in the key
-
getIVSize
public int getIVSize()- Specified by:
getIVSizein interfaceCipherInformation- Returns:
- Size of the initialization vector (in bytes)
-
getAuthenticationTagSize
public int getAuthenticationTagSize()- Specified by:
getAuthenticationTagSizein interfaceCipherInformation- Returns:
- Size of the authentication tag (AT) in bytes or 0 if this cipher does not support authentication
-
getKdfSize
public int getKdfSize()- Specified by:
getKdfSizein interfaceCipherInformation- Returns:
- The block size (in bytes) used to derive the secret key for this cipher
-
getCipherBlockSize
public int getCipherBlockSize()- Specified by:
getCipherBlockSizein interfaceCipherInformation- Returns:
- Size of block data used by the cipher (in bytes). For stream ciphers this value is (currently) used to indicate some average work buffer size to be used for the automatic re-keying mechanism described in RFC 4253 - Section 9
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceAlgorithmNameProvider
-
getTransformation
- Specified by:
getTransformationin interfaceCipherInformation- Returns:
- The actual transformation used - e.g., AES/CBC/NoPadding
-
create
-
registerExtension
Registered aNamedFactoryto be available besides the built-in ones when parsing configuration- Parameters:
extension- The factory to register- Throws:
IllegalArgumentException- if factory instance isnull, or overrides a built-in one or overrides another registered factory with the same name (case insensitive).
-
getRegisteredExtensions
- Returns:
- A
SortedSetof the currently registered extensions, sorted according to the factory name (case insensitive)
-
unregisterExtension
Unregisters specified extension- Parameters:
name- The factory name - ignored ifnull/empty- Returns:
- The registered extension -
nullif not found
-
fromString
- Parameters:
s- TheEnum's name - ignored ifnull/empty- Returns:
- The matching
BuiltinCipherswhoseEnum.name()matches (case insensitive) the provided argument -nullif no match
-
fromFactory
- Parameters:
factory- TheNamedFactoryfor the cipher - ignored ifnull- Returns:
- The matching
BuiltinCipherswhose factory name matches (case insensitive) the cipher factory name - See Also:
-
fromFactoryName
- Parameters:
name- The factory name - ignored ifnull/empty- Returns:
- The matching
BuiltinCipherswhose factory name matches (case insensitive) the provided name -nullif no match
-
parseCiphersList
- Parameters:
ciphers- A comma-separated list of ciphers' names - ignored ifnull/empty- Returns:
- A
BuiltinCiphers.ParseResultcontaining the successfully parsed factories and the unknown ones. Note: it is up to caller to ensure that the lists do not contain duplicates
-
parseCiphersList
-
parseCiphersList
-
resolveFactory
- Parameters:
name- The factory name- Returns:
- The factory or
nullif it is neither a built-in one or a registered extension
-