~ubuntu-branches/debian/sid/botan/sid

« back to all changes in this revision

Viewing changes to src/lib/misc/fpe_fe1/fpe_fe1.h

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2018-03-01 22:23:25 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20180301222325-7p7vc45gu3hta34d
Tags: 2.4.0-2
* Don't remove .doctrees from the manual if it doesn't exist.
* Don't specify parallel to debhelper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* Format Preserving Encryption (FE1 scheme)
 
3
* (C) 2009 Jack Lloyd
 
4
*
 
5
* Botan is released under the Simplified BSD License (see license.txt)
 
6
*/
 
7
 
 
8
#ifndef BOTAN_FPE_FE1_H_
 
9
#define BOTAN_FPE_FE1_H_
 
10
 
 
11
#include <botan/bigint.h>
 
12
#include <botan/symkey.h>
 
13
 
 
14
namespace Botan {
 
15
 
 
16
namespace FPE {
 
17
 
 
18
/**
 
19
* Format Preserving Encryption using the scheme FE1 from the paper
 
20
* "Format-Preserving Encryption" by Bellare, Rogaway, et al
 
21
* (https://eprint.iacr.org/2009/251)
 
22
*
 
23
* Encrypt X from and onto the group Z_n using key and tweak
 
24
* @param n the modulus
 
25
* @param X the plaintext as a BigInt
 
26
* @param key a random key
 
27
* @param tweak will modify the ciphertext (think of as an IV)
 
28
*/
 
29
BigInt BOTAN_PUBLIC_API(2,0) fe1_encrypt(const BigInt& n, const BigInt& X,
 
30
                             const SymmetricKey& key,
 
31
                             const std::vector<uint8_t>& tweak);
 
32
 
 
33
/**
 
34
* Decrypt X from and onto the group Z_n using key and tweak
 
35
* @param n the modulus
 
36
* @param X the ciphertext as a BigInt
 
37
* @param key is the key used for encryption
 
38
* @param tweak the same tweak used for encryption
 
39
*/
 
40
BigInt BOTAN_PUBLIC_API(2,0) fe1_decrypt(const BigInt& n, const BigInt& X,
 
41
                             const SymmetricKey& key,
 
42
                             const std::vector<uint8_t>& tweak);
 
43
 
 
44
}
 
45
 
 
46
}
 
47
 
 
48
#endif