summaryrefslogtreecommitdiff
path: root/oaep.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2002-10-04 17:31:41 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2002-10-04 17:31:41 +0000
commitb21162cf8e06f40baa1f58be6a8c17435cebc34d (patch)
tree8b045309c238226c32a563b1df6b9c30a2f0e0b3 /oaep.h
downloadcryptopp-b21162cf8e06f40baa1f58be6a8c17435cebc34d.tar.gz
Initial revision
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@2 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'oaep.h')
-rw-r--r--oaep.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/oaep.h b/oaep.h
new file mode 100644
index 0000000..96baaa1
--- /dev/null
+++ b/oaep.h
@@ -0,0 +1,25 @@
+#ifndef CRYPTOPP_OAEP_H
+#define CRYPTOPP_OAEP_H
+
+#include "pubkey.h"
+
+NAMESPACE_BEGIN(CryptoPP)
+
+extern byte OAEP_P_DEFAULT[]; // defined in misc.cpp
+
+/// <a href="http://www.weidai.com/scan-mirror/ca.html#cem_OAEP-MGF1">EME-OAEP</a>, for use with RSAES
+template <class H, class MGF=P1363_MGF1<H>, byte *P=OAEP_P_DEFAULT, unsigned int PLen=0>
+class OAEP : public PK_PaddingAlgorithm, public EncryptionStandard
+{
+public:
+ static std::string StaticAlgorithmName() {return "OAEP-" + MGF::StaticAlgorithmName();}
+ typedef OAEP<H, MGF, P, PLen> EncryptionPaddingAlgorithm;
+
+ unsigned int MaxUnpaddedLength(unsigned int paddedLength) const;
+ void Pad(RandomNumberGenerator &rng, const byte *raw, unsigned int inputLength, byte *padded, unsigned int paddedLength) const;
+ DecodingResult Unpad(const byte *padded, unsigned int paddedLength, byte *raw) const;
+};
+
+NAMESPACE_END
+
+#endif