aboutsummaryrefslogtreecommitdiffstats
path: root/src/pk_pad/eme_pkcs/eme_pkcs.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-01 21:20:55 +0000
committerlloyd <[email protected]>2014-01-01 21:20:55 +0000
commit197dc467dec28a04c3b2f30da7cef122dfbb13e9 (patch)
treecdbd3ddaec051c72f0a757db461973d90c37b97a /src/pk_pad/eme_pkcs/eme_pkcs.cpp
parent62faac373c07cfe10bc8c309e89ebdd30d8e5eaa (diff)
Shuffle things around. Add NIST X.509 test to build.
Diffstat (limited to 'src/pk_pad/eme_pkcs/eme_pkcs.cpp')
-rw-r--r--src/pk_pad/eme_pkcs/eme_pkcs.cpp70
1 files changed, 0 insertions, 70 deletions
diff --git a/src/pk_pad/eme_pkcs/eme_pkcs.cpp b/src/pk_pad/eme_pkcs/eme_pkcs.cpp
deleted file mode 100644
index 0e7d1fc30..000000000
--- a/src/pk_pad/eme_pkcs/eme_pkcs.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-* PKCS1 EME
-* (C) 1999-2007 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-#include <botan/eme_pkcs.h>
-
-namespace Botan {
-
-/*
-* PKCS1 Pad Operation
-*/
-secure_vector<byte> EME_PKCS1v15::pad(const byte in[], size_t inlen,
- size_t olen,
- RandomNumberGenerator& rng) const
- {
- olen /= 8;
-
- if(olen < 10)
- throw Encoding_Error("PKCS1: Output space too small");
- if(inlen > olen - 10)
- throw Encoding_Error("PKCS1: Input is too large");
-
- secure_vector<byte> out(olen);
-
- out[0] = 0x02;
- for(size_t j = 1; j != olen - inlen - 1; ++j)
- while(out[j] == 0)
- out[j] = rng.next_byte();
- buffer_insert(out, olen - inlen, in, inlen);
-
- return out;
- }
-
-/*
-* PKCS1 Unpad Operation
-*/
-secure_vector<byte> EME_PKCS1v15::unpad(const byte in[], size_t inlen,
- size_t key_len) const
- {
- if(inlen != key_len / 8 || inlen < 10 || in[0] != 0x02)
- throw Decoding_Error("PKCS1::unpad");
-
- size_t seperator = 0;
- for(size_t j = 0; j != inlen; ++j)
- if(in[j] == 0)
- {
- seperator = j;
- break;
- }
- if(seperator < 9)
- throw Decoding_Error("PKCS1::unpad");
-
- return secure_vector<byte>(&in[seperator + 1], &in[inlen]);
- }
-
-/*
-* Return the max input size for a given key size
-*/
-size_t EME_PKCS1v15::maximum_input_size(size_t keybits) const
- {
- if(keybits / 8 > 10)
- return ((keybits / 8) - 10);
- else
- return 0;
- }
-
-}