Remove old 'using std::string' from mtproto.

This commit is contained in:
John Preston 2017-04-02 20:11:30 +03:00
parent 7a7f157a8e
commit 0cdd0a9ff9
2 changed files with 3 additions and 7 deletions

View File

@ -34,8 +34,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "mtproto/dc_options.h" #include "mtproto/dc_options.h"
#include "mtproto/connection_abstract.h" #include "mtproto/connection_abstract.h"
using std::string;
namespace MTP { namespace MTP {
namespace internal { namespace internal {
namespace { namespace {

View File

@ -25,8 +25,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include <openssl/bio.h> #include <openssl/bio.h>
#include <openssl/err.h> #include <openssl/err.h>
using std::string;
namespace MTP { namespace MTP {
namespace internal { namespace internal {
@ -45,7 +43,7 @@ RSAPublicKey::RSAPublicKey(const char *key) : impl_(new Impl(key)) {
int nBytes = BN_num_bytes(impl_->rsa->n); int nBytes = BN_num_bytes(impl_->rsa->n);
int eBytes = BN_num_bytes(impl_->rsa->e); int eBytes = BN_num_bytes(impl_->rsa->e);
string nStr(nBytes, 0), eStr(eBytes, 0); std::string nStr(nBytes, 0), eStr(eBytes, 0);
BN_bn2bin(impl_->rsa->n, (uchar*)&nStr[0]); BN_bn2bin(impl_->rsa->n, (uchar*)&nStr[0]);
BN_bn2bin(impl_->rsa->e, (uchar*)&eStr[0]); BN_bn2bin(impl_->rsa->e, (uchar*)&eStr[0]);
@ -65,8 +63,8 @@ bool RSAPublicKey::isValid() const {
return impl_->rsa != nullptr; return impl_->rsa != nullptr;
} }
bool RSAPublicKey::encrypt(const void *data, string &result) const { bool RSAPublicKey::encrypt(const void *data, std::string &result) const {
t_assert(isValid()); Expects(isValid());
result.resize(256); result.resize(256);
int res = RSA_public_encrypt(256, reinterpret_cast<const unsigned char*>(data), reinterpret_cast<uchar*>(&result[0]), impl_->rsa, RSA_NO_PADDING); int res = RSA_public_encrypt(256, reinterpret_cast<const unsigned char*>(data), reinterpret_cast<uchar*>(&result[0]), impl_->rsa, RSA_NO_PADDING);