~/bend-docscommunity

src/crypto/aead.bend checks

raw source on the hub · import 0xd9a2fae439ac7ff9e21e0853948f94fe/src/crypto/aead.bend as Aead

3 imports
import Base
import ./aead/chacha20poly1305.bend as CP
import ./aesgcm.bend as GCM

Types

type Alg source · line 37 · raw

Data

Definitions

def key_size source · line 43 · raw

@alg:Alg -> Nat

def nonce_size source · line 50 · raw

@alg:Alg -> Nat

def tag_size source · line 57 · raw

Nat

def seal source · line 61 · raw

@alg:Alg -> @+key:List<&2, U32> -> @+nonce:List<&2, U32> -> @+aad:List<&2, U32> -> @+pt:List<&2, U32> -> Maybe<&2, List<&2, U32>>

ciphertext || tag (encrypt checks the key and nonce lengths first).

def open source · line 69 · raw

@alg:Alg -> @+key:List<&2, U32> -> @+nonce:List<&2, U32> -> @+aad:List<&2, U32> -> @+data:List<&2, U32> -> Maybe<&2, List<&2, U32>>

The plaintext of ciphertext || tag, or None (decrypt checks the lengths first).

def valid source · line 76 · raw

@+alg:Alg -> @+key:List<&2, U32> -> @+nonce:List<&2, U32> -> Bool

def when_open source · line 79 · raw

@ok:Bool -> @r:Maybe<&2, List<&2, U32>> -> Maybe<&2, List<&2, U32>>

def encrypt source · line 84 · raw

@+alg:Alg -> @+key:List<&2, U32> -> @+nonce:List<&2, U32> -> @+aad:List<&2, U32> -> @+pt:List<&2, U32> -> Maybe<&2, List<&2, U32>>

def decrypt source · line 87 · raw

@+alg:Alg -> @+key:List<&2, U32> -> @+nonce:List<&2, U32> -> @+aad:List<&2, U32> -> @+data:List<&2, U32> -> Maybe<&2, List<&2, U32>>