monotone

monotone Mtn Source Tree

Root/cryptopp/pkcspad.h

1#ifndef CRYPTOPP_PKCSPAD_H
2#define CRYPTOPP_PKCSPAD_H
3
4#include "cryptlib.h"
5#include "pubkey.h"
6
7NAMESPACE_BEGIN(CryptoPP)
8
9//! <a href="http://www.weidai.com/scan-mirror/ca.html#cem_PKCS1-1.5">EME-PKCS1-v1_5</a>
10class PKCS_EncryptionPaddingScheme : public PK_EncryptionMessageEncodingMethod
11{
12public:
13static const char * StaticAlgorithmName() {return "EME-PKCS1-v1_5";}
14
15unsigned int MaxUnpaddedLength(unsigned int paddedLength) const;
16void Pad(RandomNumberGenerator &rng, const byte *raw, unsigned int inputLength, byte *padded, unsigned int paddedLength) const;
17DecodingResult Unpad(const byte *padded, unsigned int paddedLength, byte *raw) const;
18};
19
20template <class H> struct PKCS_DigestDecoration
21{
22static const byte decoration[];
23static const unsigned int length;
24};
25
26//! <a href="http://www.weidai.com/scan-mirror/sig.html#sem_PKCS1-1.5">EMSA-PKCS1-v1_5</a>
27class PKCS1v15_SignatureMessageEncodingMethod : public PK_DeterministicSignatureMessageEncodingMethod
28{
29public:
30static const char * StaticAlgorithmName() {return "EMSA-PKCS1-v1_5";}
31
32void ComputeMessageRepresentative(RandomNumberGenerator &rng,
33const byte *recoverableMessage, unsigned int recoverableMessageLength,
34HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
35byte *representative, unsigned int representativeBitLength) const;
36
37struct HashIdentifierLookup
38{
39template <class H> struct HashIdentifierLookup2
40{
41static HashIdentifier Lookup()
42{
43return HashIdentifier(PKCS_DigestDecoration<H>::decoration, PKCS_DigestDecoration<H>::length);
44}
45};
46};
47};
48
49//! PKCS #1 version 1.5, for use with RSAES and RSASS
50/*! The following hash functions are supported for signature: SHA, MD2, MD5, RIPEMD160, SHA256, SHA384, SHA512. */
51struct PKCS1v15 : public SignatureStandard, public EncryptionStandard
52{
53typedef PKCS_EncryptionPaddingScheme EncryptionMessageEncodingMethod;
54typedef PKCS1v15_SignatureMessageEncodingMethod SignatureMessageEncodingMethod;
55};
56
57// PKCS_DecoratedHashModule can be instantiated with the following
58// classes as specified in PKCS#1 v2.0 and P1363a
59class SHA;
60class MD2;
61class MD5;
62class RIPEMD160;
63class Tiger;
64class SHA256;
65class SHA384;
66class SHA512;
67
68NAMESPACE_END
69
70#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status