Module: Saro::Dat

Defined in:
lib/saro-dat.rb,
lib/saro/dat/dat.rb,
lib/saro/dat/util.rb,
lib/saro/dat/crypto.rb,
lib/saro/dat/signature.rb,
lib/saro/dat/dat_manager.rb,
lib/saro/dat/dat_certificate.rb

Defined Under Namespace

Modules: Util Classes: Dat, DatCertificate, DatCrypto, DatCryptoAlgorithm, DatManager, DatPayload, DatSignature, DatSignatureAlgorithm, Error

Constant Summary collapse

CRYPTO_CONFIG =
{
  "IV-AES128-GCM" => { name: "aes-128-gcm", length: 16 },
  "IV-AES256-GCM" => { name: "aes-256-gcm", length: 32 }
}.freeze
SIGNATURE_CONFIG =
{
  "HMAC-SHA256-MFS" => { name: "HMAC", hash: "SHA256", hmac_len: 32 },
  "HMAC-SHA384-MFS" => { name: "HMAC", hash: "SHA384", hmac_len: 48 },
  "HMAC-SHA512-MFS" => { name: "HMAC", hash: "SHA512", hmac_len: 64 },
  "ECDSA-P256" => { name: "ECDSA", curve: "prime256v1", hash: "SHA256", private_len: 32, public_len: 65 },
  "ECDSA-P384" => { name: "ECDSA", curve: "secp384r1", hash: "SHA384", private_len: 48, public_len: 97 },
  "ECDSA-P521" => { name: "ECDSA", curve: "secp521r1", hash: "SHA512", private_len: 66, public_len: 133 }
}.freeze

Class Method Summary collapse

Class Method Details

.get_crypto_config(algorithm) ⇒ Object

Raises:

  • (ArgumentError)


23
24
25
26
27
# File 'lib/saro/dat/crypto.rb', line 23

def self.get_crypto_config(algorithm)
  config = CRYPTO_CONFIG[algorithm]
  return config if config
  raise ArgumentError, "Unsupported DAT Crypto Algorithm: #{algorithm}"
end

.get_signature_config(algorithm) ⇒ Object

Raises:

  • (ArgumentError)


30
31
32
33
34
# File 'lib/saro/dat/signature.rb', line 30

def self.get_signature_config(algorithm)
  config = SIGNATURE_CONFIG[algorithm]
  return config if config
  raise ArgumentError, "Unsupported DAT Crypto Algorithm: #{algorithm}"
end