def open
bend-collections@1.0.0.0 · src/crypto/aead.bend:68
import bend-collections@1.0.0.0/src/crypto/aead.bend as Aead
import Base
import bend-collections@1.0.0.0/src/crypto/aead/chacha20poly1305.bend as CP
import bend-collections@1.0.0.0/src/crypto/aesgcm.bend as GCM
68
69def open(alg: Alg, +key: List<&2, U32>, +nonce: List<&2, U32>, +aad: List<&2, U32>, +data: List<&2, U32>) -> Maybe<&2, List<&2, U32>>:
70 match alg:
71 case CHACHA20_POLY1305{}: CP.open(key, nonce, aad, data)
72 case XCHACHA20_POLY1305{}: CP.xopen(key, nonce, aad, data)
73 case AES_128_GCM{}: GCM.aes128_gcm_decrypt(key, nonce, aad, data)
74 case AES_256_GCM{}: GCM.aes256_gcm_decrypt(key, nonce, aad, data)