Fabcoin Core  0.16.2
P2P Digital Currency
oaep.h
Go to the documentation of this file.
1 #ifndef CRYPTOPP_OAEP_H
2 #define CRYPTOPP_OAEP_H
3 
4 #include "cryptlib.h"
5 #include "pubkey.h"
6 #include "sha.h"
7 
9 
12 {
13 public:
14  bool ParameterSupported(const char *name) const {return strcmp(name, Name::EncodingParameters()) == 0;}
15  size_t MaxUnpaddedLength(size_t paddedLength) const;
16  void Pad(RandomNumberGenerator &rng, const byte *raw, size_t inputLength, byte *padded, size_t paddedLength, const NameValuePairs &parameters) const;
17  DecodingResult Unpad(const byte *padded, size_t paddedLength, byte *raw, const NameValuePairs &parameters) const;
18 
19 protected:
20  virtual unsigned int DigestSize() const =0;
21  virtual HashTransformation * NewHash() const =0;
22  virtual MaskGeneratingFunction * NewMGF() const =0;
23 };
24 
27 template <class H, class MGF=P1363_MGF1>
28 class OAEP : public OAEP_Base, public EncryptionStandard
29 {
30 public:
31  static std::string CRYPTOPP_API StaticAlgorithmName() {return std::string("OAEP-") + MGF::StaticAlgorithmName() + "(" + H::StaticAlgorithmName() + ")";}
33 
34 protected:
35  unsigned int DigestSize() const {return H::DIGESTSIZE;}
36  HashTransformation * NewHash() const {return new H;}
37  MaskGeneratingFunction * NewMGF() const {return new MGF;}
38 };
39 
41 
43 
44 #endif
OAEP padding base class.
Definition: oaep.h:11
uint8_t byte
Definition: Common.h:57
#define NAMESPACE_BEGIN(x)
Definition: config.h:200
#define CRYPTOPP_DLL_TEMPLATE_CLASS
Definition: config.h:720
Abstract base classes that provide a uniform interface to this library.
Message encoding method for public key encryption.
Definition: pubkey.h:214
Interface for random number generators.
Definition: cryptlib.h:1188
OAEP< H, MGF > EncryptionMessageEncodingMethod
Definition: oaep.h:32
bool ParameterSupported(const char *name) const
Definition: oaep.h:14
unsigned int DigestSize() const
Definition: oaep.h:35
Returns a decoding results.
Definition: cryptlib.h:238
static std::string CRYPTOPP_API StaticAlgorithmName()
Definition: oaep.h:31
const char * name
Definition: rest.cpp:36
Base class for public key encryption standard classes.
Definition: pubkey.h:2066
#define H(x, y, z)
Definition: Hash.cpp:81
#define CRYPTOPP_API
Definition: config.h:705
Mask generation function interface.
Definition: pubkey.h:666
MaskGeneratingFunction * NewMGF() const
Definition: oaep.h:37
HashTransformation * NewHash() const
Definition: oaep.h:36
Classes for SHA-1 and SHA-2 family of message digests.
Interface for hash functions and data processing part of MACs.
Definition: cryptlib.h:930
bytes padded(bytes _b, unsigned _l)
Add &#39;0&#39; on, or remove items from, the front of _b until it is of length _l.
Definition: CommonJS.cpp:47
#define NAMESPACE_END
Definition: config.h:201
std::vector< char * > parameters
Definition: boostTest.cpp:46
#define CRYPTOPP_DLL
Definition: config.h:704
OAEP padding.
Definition: oaep.h:28
Interface for retrieving values given their names.
Definition: cryptlib.h:279