public enum BuiltinCiphers extends java.lang.Enum<BuiltinCiphers> implements CipherFactory
Modifier and Type | Class and Description |
---|---|
static class |
BuiltinCiphers.Constants |
static class |
BuiltinCiphers.ParseResult
Holds the result of
parseCiphersList(String) |
Enum Constant and Description |
---|
aes128cbc |
aes128ctr |
aes192cbc |
aes192ctr |
aes256cbc |
aes256ctr |
arcfour128 |
arcfour256 |
blowfishcbc |
none |
tripledescbc |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
algorithm |
private int |
blkSize |
private static java.util.Map<java.lang.String,CipherFactory> |
EXTENSIONS |
private java.lang.String |
factoryName |
private int |
ivsize |
private int |
kdfSize |
private int |
keysize |
private boolean |
supported |
private java.lang.String |
transformation |
static java.util.Set<BuiltinCiphers> |
VALUES |
BY_NAME_COMPARATOR, NAME_EXTRACTOR
FALSE, TRUE
Modifier and Type | Method and Description |
---|---|
Cipher |
create() |
static BuiltinCiphers |
fromFactory(NamedFactory<Cipher> factory) |
static BuiltinCiphers |
fromFactoryName(java.lang.String name) |
static BuiltinCiphers |
fromString(java.lang.String s) |
java.lang.String |
getAlgorithm() |
int |
getCipherBlockSize() |
int |
getIVSize() |
int |
getKdfSize() |
int |
getKeySize() |
java.lang.String |
getName() |
static java.util.NavigableSet<CipherFactory> |
getRegisteredExtensions() |
java.lang.String |
getTransformation() |
boolean |
isSupported() |
static BuiltinCiphers.ParseResult |
parseCiphersList(java.util.Collection<java.lang.String> ciphers) |
static BuiltinCiphers.ParseResult |
parseCiphersList(java.lang.String... ciphers) |
static BuiltinCiphers.ParseResult |
parseCiphersList(java.lang.String ciphers) |
static void |
registerExtension(CipherFactory extension)
Registered a
NamedFactory to be available besides the built-in ones when parsing configuration |
static CipherFactory |
resolveFactory(java.lang.String name) |
java.lang.String |
toString() |
static NamedFactory<Cipher> |
unregisterExtension(java.lang.String name)
Unregisters specified extension
|
static BuiltinCiphers |
valueOf(java.lang.String name)
Returns 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.
|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
setUpFactories
create, setUpBuiltinFactories, setUpTransformedFactories
findByName, getNameList, getNames, ofName, removeByName
all, any, of
public static final BuiltinCiphers none
public static final BuiltinCiphers aes128cbc
public static final BuiltinCiphers aes128ctr
public static final BuiltinCiphers aes192cbc
public static final BuiltinCiphers aes192ctr
public static final BuiltinCiphers aes256cbc
public static final BuiltinCiphers aes256ctr
public static final BuiltinCiphers arcfour128
public static final BuiltinCiphers arcfour256
public static final BuiltinCiphers blowfishcbc
public static final BuiltinCiphers tripledescbc
public static final java.util.Set<BuiltinCiphers> VALUES
private static final java.util.Map<java.lang.String,CipherFactory> EXTENSIONS
private final java.lang.String factoryName
private final int ivsize
private final int kdfSize
private final int keysize
private final int blkSize
private final java.lang.String algorithm
private final java.lang.String transformation
private final boolean supported
public static BuiltinCiphers[] values()
for (BuiltinCiphers c : BuiltinCiphers.values()) System.out.println(c);
public static BuiltinCiphers valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic final java.lang.String getName()
getName
in interface NamedResource
public final java.lang.String toString()
toString
in class java.lang.Enum<BuiltinCiphers>
public boolean isSupported()
isSupported
in interface OptionalFeature
true
if the current JVM configuration supports this cipher - e.g., AES-256 requires the
Java Cryptography Extension (JCE)public int getKeySize()
getKeySize
in interface KeySizeIndicator
public int getIVSize()
getIVSize
in interface CipherInformation
public int getKdfSize()
getKdfSize
in interface CipherInformation
public int getCipherBlockSize()
getCipherBlockSize
in interface CipherInformation
public java.lang.String getAlgorithm()
getAlgorithm
in interface AlgorithmNameProvider
public java.lang.String getTransformation()
getTransformation
in interface CipherInformation
public Cipher create()
public static void registerExtension(CipherFactory extension)
NamedFactory
to be available besides the built-in ones when parsing configurationextension
- The factory to registerjava.lang.IllegalArgumentException
- if factory instance is null
, or overrides a built-in one or overrides
another registered factory with the same name (case insensitive).public static java.util.NavigableSet<CipherFactory> getRegisteredExtensions()
SortedSet
of the currently registered extensions, sorted according to the factory name (case
insensitive)public static NamedFactory<Cipher> unregisterExtension(java.lang.String name)
name
- The factory name - ignored if null
/emptynull
if not foundpublic static BuiltinCiphers fromString(java.lang.String s)
s
- The Enum
's name - ignored if null
/emptyBuiltinCiphers
whose Enum.name()
matches (case insensitive) the
provided argument - null
if no matchpublic static BuiltinCiphers fromFactory(NamedFactory<Cipher> factory)
factory
- The NamedFactory
for the cipher - ignored if null
BuiltinCiphers
whose factory name matches (case insensitive) the
cipher factory namefromFactoryName(String)
public static BuiltinCiphers fromFactoryName(java.lang.String name)
name
- The factory name - ignored if null
/emptyBuiltinCiphers
whose factory name matches (case insensitive) the
provided name - null
if no matchpublic static BuiltinCiphers.ParseResult parseCiphersList(java.lang.String ciphers)
ciphers
- A comma-separated list of ciphers' names - ignored if null
/emptyBuiltinCiphers.ParseResult
containing the successfully parsed factories and the unknown ones.
Note: it is up to caller to ensure that the lists do not contain duplicatespublic static BuiltinCiphers.ParseResult parseCiphersList(java.lang.String... ciphers)
public static BuiltinCiphers.ParseResult parseCiphersList(java.util.Collection<java.lang.String> ciphers)
public static CipherFactory resolveFactory(java.lang.String name)
name
- The factory namenull
if it is neither a built-in one or a registered extension