00001 #ifndef CRYPTOPP_PKCSPAD_H
00002 #define CRYPTOPP_PKCSPAD_H
00003
00004 #include "cryptlib.h"
00005 #include "pubkey.h"
00006
00007 NAMESPACE_BEGIN(CryptoPP)
00008
00009
00010 class PKCS_EncryptionPaddingScheme : public PK_EncryptionMessageEncodingMethod
00011 {
00012 public:
00013 static const char * StaticAlgorithmName() {return "EME-PKCS1-v1_5";}
00014
00015 unsigned int MaxUnpaddedLength(unsigned int paddedLength) const;
00016 void Pad(RandomNumberGenerator &rng, const byte *raw, unsigned int inputLength, byte *padded, unsigned int paddedLength) const;
00017 DecodingResult Unpad(const byte *padded, unsigned int paddedLength, byte *raw) const;
00018 };
00019
00020 template <class H> struct PKCS_DigestDecoration
00021 {
00022 static const byte decoration[];
00023 static const unsigned int length;
00024 };
00025
00026
00027 class PKCS1v15_SignatureMessageEncodingMethod : public PK_DeterministicSignatureMessageEncodingMethod
00028 {
00029 public:
00030 static const char * StaticAlgorithmName() {return "EMSA-PKCS1-v1_5";}
00031
00032 void ComputeMessageRepresentative(RandomNumberGenerator &rng,
00033 const byte *recoverableMessage, unsigned int recoverableMessageLength,
00034 HashTransformation &hash, HashIdentifier hashIdentifier, bool messageEmpty,
00035 byte *representative, unsigned int representativeBitLength) const;
00036
00037 struct HashIdentifierLookup
00038 {
00039 template <class H> struct HashIdentifierLookup2
00040 {
00041 static HashIdentifier Lookup()
00042 {
00043 return HashIdentifier(PKCS_DigestDecoration<H>::decoration, PKCS_DigestDecoration<H>::length);
00044 }
00045 };
00046 };
00047 };
00048
00049
00050
00051 struct PKCS1v15 : public SignatureStandard, public EncryptionStandard
00052 {
00053 typedef PKCS_EncryptionPaddingScheme EncryptionMessageEncodingMethod;
00054 typedef PKCS1v15_SignatureMessageEncodingMethod SignatureMessageEncodingMethod;
00055 };
00056
00057
00058
00059 class SHA;
00060 class MD2;
00061 class MD5;
00062 class RIPEMD160;
00063 class Tiger;
00064 class SHA256;
00065 class SHA384;
00066 class SHA512;
00067
00068 NAMESPACE_END
00069
00070 #endif