Module: Toybox::Cryptography
Overview
Defined Under Namespace
Classes: Cipher, CipherBasedMessageAuthenticationCode, Hash, HashBasedMessageAuthenticationCode, InvalidBlockSizeException, Key, KeyAgreement, KeyPair
Constant Summary
 HASH_SHA1 = 0
SHA1 implementation for Hash objects
 HASH_SHA256 = 1
SHA256 implementation for Hash objects
 HASH_MD5 = 2
MD5 implementation for Hash objects
 CIPHER_AES128 = 0
AES128 implementation for Cipher objects
 CIPHER_AES256 = 1
AES256 implementation for Cipher objects
 MODE_ECB = 0
Electronic Code Book (ECB)
This is the simplest encryption mode. Each plaintext block is directly encrypted into a ciphertext block, independent of any other block. This mode exposes frequency of symbols in your plaintext. Other modes (e.g. CBC) are recommended.
 MODE_CBC = 1
CipherBlock Chaining
Each ciphertext block depends on the current and all previous plaintext blocks. An Initialization Vector (IV) is required. The IV is a data block to be transmitted to the receiver. The IV can be made public, but it must be authenticated by the receiver and it should be picked randomly.
 KEY_PAIR_ELLIPTIC_CURVE_SECP224R1 = 0
224bit secp224r1 Elliptic Curve
Based on the algebraic structure of elliptic curves over finite fields. ECC requires smaller keys compared to nonECC cryptography to provide equivalent security.
 KEY_PAIR_ELLIPTIC_CURVE_SECP256R1 = 1
256bit secp256r1 Elliptic Curve
Based on the algebraic structure of elliptic curves over finite fields. ECC requires smaller keys compared to nonECC cryptography to provide equivalent security.
 KEY_AGREEMENT_ECDH = 0
Elliptic Curve DiffieHellman (ECDH)
Instance Method Summary collapse

createPublicKey(algorithm, bytes) ⇒ Toybox::Cryptography::Key
Create a public Key object from bytes to be added to a KeyAgreement.

randomBytes(size) ⇒ Toybox::Lang::ByteArray
Generates cryptographically random bytes.
Instance Method Details
createPublicKey(algorithm, bytes) ⇒ Toybox::Cryptography::Key
Create a public Key object from bytes to be added to a KeyAgreement.
If a public key is received from another party, it can be converted to a Key object using this method.
3749 3750 
# File 'Monkeybrains.rb', line 3749
def createPublicKey(algorithm, bytes)
end

randomBytes(size) ⇒ Toybox::Lang::ByteArray
Generates cryptographically random bytes.
3832 3833 
# File 'Monkeybrains.rb', line 3832
def randomBytes(size)
end
