dec: Decrypt a ciphertext

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/dec.R

Description

This decrypts an integer message which has been encrypted under one of the homomorphic schemes supported by this package.

Usage

1
dec(sk, ct)

Arguments

sk

a private/secret key for any scheme as generated by the keygen. function.

ct

a ciphertext as produced from a call to enc.

Details

Note that the scheme specified by the private key, sk, and the ciphertext, ct, must match.

If a symmetric key scheme is being used, then the secret key should be provided for the sk argument.

Value

The decrypted integer message. If the value is in the range of a standard integer in R (-2147483647 to 2147483647) then an integer will be returned, otherwise a bigz big integer object from the gmp package will be returned.

Author(s)

Louis Aslett

See Also

enc to encrypt messages to ciphertexts which this function decrypts.

Examples

1
2
3
4
p <- pars("FandV")
keys <- keygen(p)
ct <- enc(keys$pk, 1)
dec(keys$sk, ct)

iamtrask/R-Homomorphic-Encryption-Package documentation built on May 29, 2019, 2:56 p.m.