Package net.i2p.crypto
Enum EncType
- All Implemented Interfaces:
Serializable
,Comparable<EncType>
,java.lang.constant.Constable
Defines the properties for various encryption types
that I2P supports or may someday support.
All PublicKeys and PrivateKeys have a type.
Note that a EncType specifies both an algorithm and parameters, so that
we may change primes or curves for a given algorithm.
- Since:
- 0.9.18
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionUsed by i2pd.Reserved, not used by anybody.Reserved, not used by anybody.Proposal 144.2048-bit MODP Group from RFC 3526. -
Method Summary
Modifier and TypeMethodDescriptionthe standard name used for the Java crypto factoriesthe standard base algorithm name used for the Java crypto factoriesstatic EncType
getByCode
(int code) int
getCode()
the unique identifier for this typeThe elliptic curve ECParameterSpec for ECDSA; DSAParameterSpec for DSAint
the length of the private key, in bytesint
the length of the public key, in bytesThe router version in which this type was first supported.boolean
static boolean
isAvailable
(int code) static boolean
isAvailable
(String stype) static EncType
parseEncType
(String stype) Convenience for user appsstatic EncType
Returns the enum constant of this type with the specified name.static EncType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
ELGAMAL_2048
2048-bit MODP Group from RFC 3526. This is the default. Pubkey 256 bytes, privkey 256 bytes. -
EC_P256
Used by i2pd. Not yet supported by Java I2P. Pubkey 64 bytes; privkey 32 bytes. See proposal 145. -
EC_P384
Reserved, not used by anybody. Pubkey 96 bytes; privkey 48 bytes. See proposal 145. -
EC_P521
Reserved, not used by anybody. Pubkey 132 bytes; privkey 66 bytes. See proposal 145. -
ECIES_X25519
Proposal 144. Pubkey 32 bytes; privkey 32 bytes- Since:
- 0.9.38
-
-
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
-
getCode
public int getCode()the unique identifier for this type -
getPubkeyLen
public int getPubkeyLen()the length of the public key, in bytes -
getPrivkeyLen
public int getPrivkeyLen()the length of the private key, in bytes -
getBaseAlgorithm
the standard base algorithm name used for the Java crypto factories -
getAlgorithmName
the standard name used for the Java crypto factories -
getParams
The elliptic curve ECParameterSpec for ECDSA; DSAParameterSpec for DSA- Throws:
InvalidParameterSpecException
- if the algorithm is not available on this JVM.
-
getSupportedSince
The router version in which this type was first supported. -
isAvailable
public boolean isAvailable()- Returns:
- true if supported in this JVM
-
isAvailable
public static boolean isAvailable(int code) - Returns:
- true if supported in this JVM
-
isAvailable
- Parameters:
stype
- number or name- Returns:
- true if supported in this JVM
-
getByCode
- Returns:
- null if not supported
-
parseEncType
Convenience for user apps- Parameters:
stype
- number or name- Returns:
- null if not found
-