net.i2p.crypto

## Enum SigType

- java.lang.Object
- - java.lang.Enum<SigType>
  - - net.i2p.crypto.SigType

- All Implemented Interfaces:
    Serializable, Comparable<SigType>

      public enum SigType
      extends Enum<SigType>

  Defines the properties for various signature types that I2P supports or may someday support. All Signatures, SigningPublicKeys, and SigningPrivateKeys have a type. Note that a SigType specifies both an algorithm and parameters, so that we may change primes or curves for a given algorithm.

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `DSA_SHA1` DSA_SHA1 is the default.
    `ECDSA_SHA256_P256` Pubkey 64 bytes; privkey 32 bytes; hash 32 bytes; sig 64 bytes
    `ECDSA_SHA384_P384` Pubkey 96 bytes; privkey 48 bytes; hash 48 bytes; sig 96 bytes
    `ECDSA_SHA512_P521` Pubkey 132 bytes; privkey 66 bytes; hash 64 bytes; sig 132 bytes
    `EdDSA_SHA512_Ed25519` Pubkey 32 bytes; privkey 32 bytes; hash 64 bytes; sig 64 bytes Due to bugs in previous versions, minimum version is 0.9.17.
    `EdDSA_SHA512_Ed25519ph` Prehash version (double hashing, for offline use such as su3, not for use on the network) Pubkey 32 bytes; privkey 32 bytes; hash 64 bytes; sig 64 bytes
    `RedDSA_SHA512_Ed25519` Blinded version of EdDSA, use for encrypted LS2 Pubkey 32 bytes; privkey 32 bytes; hash 64 bytes; sig 64 bytes
    `RSA_SHA256_2048` Pubkey 256 bytes; privkey 512 bytes; hash 32 bytes; sig 256 bytes
    `RSA_SHA384_3072` Pubkey 384 bytes; privkey 768 bytes; hash 48 bytes; sig 384 bytes
    `RSA_SHA512_4096` Pubkey 512 bytes; privkey 1024 bytes; hash 64 bytes; sig 512 bytes

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getAlgorithmName()` the standard name used for the Java crypto factories
    `SigAlgo` | `getBaseAlgorithm()` the standard base algorithm name used for the Java crypto factories
    `static SigType` | `getByCode(int code)` Gets the signature type by code.
    `int` | `getCode()` the unique identifier for this type
    `MessageDigest` | `getDigestInstance()` Gets a MessageDigest instance for this signature type.
    `SimpleDataStructure` | `getHashInstance()` Gets a Hash instance for this signature type.
    `int` | `getHashLen()` the length of the hash, in bytes
    `String` | `getOID()` The OID for the signature.
    `AlgorithmParameterSpec` | `getParams()` The elliptic curve ECParameterSpec for ECDSA; DSAParameterSpec for DSA
    `int` | `getPrivkeyLen()` the length of the private key, in bytes
    `int` | `getPubkeyLen()` the length of the public key, in bytes
    `int` | `getSigLen()` the length of the signature, in bytes
    `String` | `getSupportedSince()` The router version in which this type was first supported.
    `boolean` | `isAvailable()` Checks if this signature type is available in the JVM.
    `static boolean` | `isAvailable(int code)` Checks if the signature type with the given code is available.
    `static boolean` | `isAvailable(String stype)` Checks if the signature type with the given name or number is available.
    `static SigType` | `parseSigType(String stype)` Convenience for user apps
    `static SigType` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static SigType[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Enum Constant Detail

    - #### DSA_SHA1

          public static final SigType DSA_SHA1

      DSA_SHA1 is the default. Pubkey 128 bytes; privkey 20 bytes; hash 20 bytes; sig 40 bytes

    - #### ECDSA_SHA256_P256

          public static final SigType ECDSA_SHA256_P256

      Pubkey 64 bytes; privkey 32 bytes; hash 32 bytes; sig 64 bytes

    - #### ECDSA_SHA384_P384

          public static final SigType ECDSA_SHA384_P384

      Pubkey 96 bytes; privkey 48 bytes; hash 48 bytes; sig 96 bytes

    - #### ECDSA_SHA512_P521

          public static final SigType ECDSA_SHA512_P521

      Pubkey 132 bytes; privkey 66 bytes; hash 64 bytes; sig 132 bytes

    - #### EdDSA_SHA512_Ed25519

          public static final SigType EdDSA_SHA512_Ed25519

      Pubkey 32 bytes; privkey 32 bytes; hash 64 bytes; sig 64 bytes Due to bugs in previous versions, minimum version is 0.9.17.

    - #### EdDSA_SHA512_Ed25519ph

          public static final SigType EdDSA_SHA512_Ed25519ph

      Prehash version (double hashing, for offline use such as su3, not for use on the network) Pubkey 32 bytes; privkey 32 bytes; hash 64 bytes; sig 64 bytes

    - #### RedDSA_SHA512_Ed25519

          public static final SigType RedDSA_SHA512_Ed25519

      Blinded version of EdDSA, use for encrypted LS2 Pubkey 32 bytes; privkey 32 bytes; hash 64 bytes; sig 64 bytes

    - #### RSA_SHA256_2048

          public static final SigType RSA_SHA256_2048

      Pubkey 256 bytes; privkey 512 bytes; hash 32 bytes; sig 256 bytes

    - #### RSA_SHA384_3072

          public static final SigType RSA_SHA384_3072

      Pubkey 384 bytes; privkey 768 bytes; hash 48 bytes; sig 384 bytes

    - #### RSA_SHA512_4096

          public static final SigType RSA_SHA512_4096

      Pubkey 512 bytes; privkey 1024 bytes; hash 64 bytes; sig 512 bytes

  - ### Method Detail

    - #### getAlgorithmName

          public String getAlgorithmName()

      the standard name used for the Java crypto factories

    - #### getBaseAlgorithm

          public SigAlgo getBaseAlgorithm()

      the standard base algorithm name used for the Java crypto factories

    - #### getByCode

          public static SigType getByCode(int code)

      Gets the signature type by code.
      Returns:
        null if not supported

    - #### getCode

          public int getCode()

      the unique identifier for this type

    - #### getDigestInstance

          public MessageDigest getDigestInstance()

      Gets a MessageDigest instance for this signature type.
      Throws:
        `UnsupportedOperationException` - if not supported

    - #### getHashInstance

          public SimpleDataStructure getHashInstance()

      Gets a Hash instance for this signature type.
      Throws:
        `UnsupportedOperationException` - if not supported

    - #### getHashLen

          public int getHashLen()

      the length of the hash, in bytes

    - #### getOID

          public String getOID()

      The OID for the signature.

    - #### getParams

          public AlgorithmParameterSpec getParams()
                                           throws InvalidParameterSpecException

      The elliptic curve ECParameterSpec for ECDSA; DSAParameterSpec for DSA
      Throws:
        `InvalidParameterSpecException` - if the algorithm is not available on this JVM.

    - #### getPrivkeyLen

          public int getPrivkeyLen()

      the length of the private key, in bytes

    - #### getPubkeyLen

          public int getPubkeyLen()

      the length of the public key, in bytes

    - #### getSigLen

          public int getSigLen()

      the length of the signature, in bytes

    - #### getSupportedSince

          public String getSupportedSince()

      The router version in which this type was first supported.

    - #### isAvailable

          public boolean isAvailable()

      Checks if this signature type is available in the JVM.
      Returns:
        true if supported in this JVM

    - #### isAvailable

          public static boolean isAvailable(int code)

      Checks if the signature type with the given code is available.
      Returns:
        true if supported in this JVM

    - #### isAvailable

          public static boolean isAvailable(String stype)

      Checks if the signature type with the given name or number is available.
      Parameters:
        `stype` - number or name
      Returns:
        true if supported in this JVM

    - #### parseSigType

          public static SigType parseSigType(String stype)

      Convenience for user apps
      Parameters:
        `stype` - number or name
      Returns:
        null if not found

    - #### valueOf

          public static SigType valueOf(String name)

      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 name
        `NullPointerException` - if the argument is null

    - #### values

          public static SigType[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (SigType c : SigType.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared