key_sodium: Symmetric encryption with sodium

View source: R/sodium.R

key_sodiumR Documentation

Symmetric encryption with sodium

Description

Wrap a sodium symmetric key. This can be used with the functions encrypt_data() and decrypt_data(), along with the higher level wrappers encrypt() and decrypt(). With a symmetric key, everybody uses the same key for encryption and decryption.

Usage

key_sodium(key)

Arguments

key

A sodium key (i.e., generated with sodium::keygen()

Examples

# Create a new key
key <- cyphr::key_sodium(sodium::keygen())
key

# With this key encrypt a string
secret <- cyphr::encrypt_string("my secret string", key)
# And decrypt it again:
cyphr::decrypt_string(secret, key)

dide-tools/encryptr documentation built on Aug. 29, 2023, 11:55 p.m.