Fabcoin Core  0.16.2
P2P Digital Currency
pkcspad.h
Go to the documentation of this file.
1 // pkcspad.h - written and placed in the public domain by Wei Dai
2 
6 
7 #ifndef CRYPTOPP_PKCSPAD_H
8 #define CRYPTOPP_PKCSPAD_H
9 
10 #include "cryptlib.h"
11 #include "pubkey.h"
12 
13 #ifdef CRYPTOPP_IS_DLL
14 #include "sha.h"
15 #endif
16 
18 
23 {
24 public:
25  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "EME-PKCS1-v1_5";}
26 
27  size_t MaxUnpaddedLength(size_t paddedLength) const;
28  void Pad(RandomNumberGenerator &rng, const byte *raw, size_t inputLength, byte *padded, size_t paddedLength, const NameValuePairs &parameters) const;
29  DecodingResult Unpad(const byte *padded, size_t paddedLength, byte *raw, const NameValuePairs &parameters) const;
30 };
31 
34 template <class H> class PKCS_DigestDecoration
35 {
36 public:
37  static const byte decoration[];
38  static const unsigned int length;
39 };
40 
41 // PKCS_DigestDecoration can be instantiated with the following
42 // classes as specified in PKCS#1 v2.0 and P1363a
43 class SHA1;
44 class SHA224;
45 class SHA256;
46 class SHA384;
47 class SHA512;
48 class Tiger;
49 class RIPEMD160;
50 namespace Weak1 {
51 class MD2;
52 class MD5;
53 }
54 // end of list
55 
56 #ifdef CRYPTOPP_IS_DLL
62 #endif
63 
68 {
69 public:
70  CRYPTOPP_STATIC_CONSTEXPR const char* CRYPTOPP_API StaticAlgorithmName() {return "EMSA-PKCS1-v1_5";}
71 
72  size_t MinRepresentativeBitLength(size_t hashIdentifierSize, size_t digestSize) const
73  {return 8 * (digestSize + hashIdentifierSize + 10);}
74 
75  void ComputeMessageRepresentative(RandomNumberGenerator &rng,
76  const byte *recoverableMessage, size_t recoverableMessageLength,
77  HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
78  byte *representative, size_t representativeBitLength) const;
79 
81  {
82  template <class H> struct HashIdentifierLookup2
83  {
85  {
87  }
88  };
89  };
90 };
91 
93 
99 {
102 };
103 
105 
106 #endif
SHA-384 message digest.
Definition: sha.h:81
uint8_t byte
Definition: Common.h:57
#define CRYPTOPP_STATIC_CONSTEXPR
Definition: config.h:892
SHA-256 message digest.
Definition: sha.h:39
Tiger
Definition: tiger.h:16
#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.
RIPEMD-160 message digest.
Definition: ripemd.h:17
Message encoding method for public key encryption.
Definition: pubkey.h:214
Interface for random number generators.
Definition: cryptlib.h:1188
CRYPTOPP_STATIC_CONSTEXPR const char *CRYPTOPP_API StaticAlgorithmName()
Definition: pkcspad.h:70
Base class for public key signature standard classes.
Definition: pubkey.h:2071
PKCS#1 v1.5 Encryption Padding Scheme.
Definition: pkcspad.h:22
Returns a decoding results.
Definition: cryptlib.h:238
Interface for message encoding method for public key signature schemes.
Definition: pubkey.h:404
SHA-512 message digest.
Definition: sha.h:69
PKCS #1 version 1.5, for use with RSAES and RSASS.
Definition: pkcspad.h:98
Base class for public key encryption standard classes.
Definition: pubkey.h:2066
SHA-1 message digest.
Definition: sha.h:25
size_t MinRepresentativeBitLength(size_t hashIdentifierSize, size_t digestSize) const
Definition: pkcspad.h:72
#define CRYPTOPP_API
Definition: config.h:705
PKCS#1 v1.5 Signature Encoding Scheme.
Definition: pkcspad.h:67
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
PKCS1v15_SignatureMessageEncodingMethod SignatureMessageEncodingMethod
Definition: pkcspad.h:101
PKCS#1 decoration data structure.
Definition: pkcspad.h:34
#define NAMESPACE_END
Definition: config.h:201
std::vector< char * > parameters
Definition: boostTest.cpp:46
std::pair< const byte *, unsigned int > HashIdentifier
Definition: pubkey.h:314
#define CRYPTOPP_DLL
Definition: config.h:704
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
Definition: pkcspad.h:25
SHA-224 message digest.
Definition: sha.h:54
PKCS_EncryptionPaddingScheme EncryptionMessageEncodingMethod
Definition: pkcspad.h:100
static const unsigned int length
Definition: pkcspad.h:38
const byte decoration[]
Definition: pkcspad.cpp:16
Definition: arc4.cpp:14
Interface for retrieving values given their names.
Definition: cryptlib.h:279