Class: Virgil::SDK::Cryptography::Keys::KeyPairType

Inherits:
Object
  • Object
show all
Defined in:
lib/virgil/sdk/cryptography/keys/key_pair_type.rb

Overview

Enumeration containing supported KeyPairTypes

Defined Under Namespace

Classes: UnknownTypeException

Constant Summary collapse

Default =
:Default
RSA_2048 =
:RSA_2048
RSA_3072 =
:RSA_3072
RSA_4096 =
:RSA_4096
RSA_8192 =
:RSA_8192
EC_SECP256R1 =
:EC_SECP256R1
EC_SECP384R1 =
:EC_SECP384R1
EC_SECP521R1 =
:EC_SECP521R1
EC_BP256R1 =
:EC_BP256R1
EC_BP384R1 =
:EC_BP384R1
EC_BP512R1 =
:EC_BP512R1
EC_SECP256K1 =
:EC_SECP256K1
EC_CURVE25519 =
:EC_CURVE25519
FAST_EC_X25519 =
:FAST_EC_X25519
FAST_EC_ED25519 =
:FAST_EC_ED25519
TYPES_TO_NATIVE =
{
  Default: Crypto::Native::VirgilKeyPair::Type_FAST_EC_ED25519,
  RSA_2048: Crypto::Native::VirgilKeyPair::Type_RSA_2048,
  RSA_3072: Crypto::Native::VirgilKeyPair::Type_RSA_3072,
  RSA_4096: Crypto::Native::VirgilKeyPair::Type_RSA_4096,
  RSA_8192: Crypto::Native::VirgilKeyPair::Type_RSA_8192,
  EC_SECP256R1: Crypto::Native::VirgilKeyPair::Type_EC_SECP256R1,
  EC_SECP384R1: Crypto::Native::VirgilKeyPair::Type_EC_SECP384R1,
  EC_SECP521R1: Crypto::Native::VirgilKeyPair::Type_EC_SECP521R1,
  EC_BP256R1: Crypto::Native::VirgilKeyPair::Type_EC_BP256R1,
  EC_BP384R1: Crypto::Native::VirgilKeyPair::Type_EC_BP384R1,
  EC_BP512R1: Crypto::Native::VirgilKeyPair::Type_EC_BP512R1,
  EC_SECP256K1: Crypto::Native::VirgilKeyPair::Type_EC_SECP256K1,
  EC_CURVE25519: Crypto::Native::VirgilKeyPair::Type_EC_CURVE25519,
  FAST_EC_X25519: Crypto::Native::VirgilKeyPair::Type_FAST_EC_X25519,
  FAST_EC_ED25519: Crypto::Native::VirgilKeyPair::Type_FAST_EC_ED25519,
}

Class Method Summary collapse

Class Method Details

.convert_to_native(key_pair_type) ⇒ Integer

Converts type enum value to native value

Parameters:

  • key_pair_type (Symbol)

    type id for conversion.

Returns:

  • (Integer)

    Native library key pair type id.

Raises:



92
93
94
95
96
97
# File 'lib/virgil/sdk/cryptography/keys/key_pair_type.rb', line 92

def self.convert_to_native(key_pair_type)
  if TYPES_TO_NATIVE.has_key?(key_pair_type)
    return TYPES_TO_NATIVE[key_pair_type]
  end
  raise UnknownTypeException.new(key_pair_type)
end