diff options
author | lloyd <[email protected]> | 2010-06-15 02:47:32 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-06-15 02:47:32 +0000 |
commit | 15bca8f20c0ccb69ee4aa18977477a42c33d0a07 (patch) | |
tree | 7dbefb044850f04435205eca67146860f56e0ea6 /src/wrap/python | |
parent | 2e37a86957c222972811928696f874bc1284cbbf (diff) |
Use X509::BER_encode in the Python wrappers
Diffstat (limited to 'src/wrap/python')
-rw-r--r-- | src/wrap/python/rsa.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/wrap/python/rsa.cpp b/src/wrap/python/rsa.cpp index 8b9fa80ea..2aa30efd7 100644 --- a/src/wrap/python/rsa.cpp +++ b/src/wrap/python/rsa.cpp @@ -38,11 +38,10 @@ class Py_RSA_PrivateKey std::string to_ber() const { - Pipe out; - out.start_msg(); - PKCS8::encode(*rsa_key, out, RAW_BER); - out.end_msg(); - return out.read_all_as_string(); + SecureVector<byte> bits = PKCS8::BER_encode(*rsa_key); + + return std;:string(reinterpret_cast<const char*>(&bits[0]), + bits.size()); } std::string get_N() const { return bigint2str(get_bigint_N()); } @@ -124,11 +123,10 @@ class Py_RSA_PublicKey std::string to_ber() const { - Pipe out; - out.start_msg(); - X509::encode(*rsa_key, out, RAW_BER); - out.end_msg(); - return out.read_all_as_string(); + SecureVector<byte> bits = X509::BER_encode(*rsa_key); + + return std;:string(reinterpret_cast<const char*>(&bits[0]), + bits.size()); } std::string encrypt(const std::string& in, |