mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-31 16:04:27 +02:00
code cleanup; fix move ctors and assignment
This commit is contained in:
parent
de52e23d12
commit
18adb1e43b
@ -38,7 +38,7 @@ class Crypto_API CipherKey
|
|||||||
/// file.
|
/// file.
|
||||||
///
|
///
|
||||||
/// To create a key using a human-readable password
|
/// To create a key using a human-readable password
|
||||||
/// string, use the following code. We create a AES Cipher and
|
/// string, use the following code. We create a AES Cipher and
|
||||||
/// use a salt value to make the key more robust:
|
/// use a salt value to make the key more robust:
|
||||||
///
|
///
|
||||||
/// std::string password = "secret";
|
/// std::string password = "secret";
|
||||||
@ -68,16 +68,16 @@ public:
|
|||||||
/// an iteration count of at least 1000.
|
/// an iteration count of at least 1000.
|
||||||
};
|
};
|
||||||
|
|
||||||
CipherKey(const std::string& name,
|
CipherKey(const std::string& name,
|
||||||
const std::string& passphrase,
|
const std::string& passphrase,
|
||||||
const std::string& salt = "",
|
const std::string& salt = "",
|
||||||
int iterationCount = DEFAULT_ITERATION_COUNT,
|
int iterationCount = DEFAULT_ITERATION_COUNT,
|
||||||
const std::string& digest = "md5");
|
const std::string& digest = "md5");
|
||||||
/// Creates a new CipherKeyImpl object using the given
|
/// Creates a new CipherKeyImpl object using the given
|
||||||
/// cipher name, passphrase, salt value, iteration count and digest.
|
/// cipher name, passphrase, salt value, iteration count and digest.
|
||||||
|
|
||||||
CipherKey(const std::string& name,
|
CipherKey(const std::string& name,
|
||||||
const ByteVec& key,
|
const ByteVec& key,
|
||||||
const ByteVec& iv);
|
const ByteVec& iv);
|
||||||
/// Creates a new CipherKeyImpl object using the given cipher
|
/// Creates a new CipherKeyImpl object using the given cipher
|
||||||
/// name, key and initialization vector (IV).
|
/// name, key and initialization vector (IV).
|
||||||
@ -87,12 +87,24 @@ public:
|
|||||||
/// a custom IV size.
|
/// a custom IV size.
|
||||||
|
|
||||||
CipherKey(const std::string& name);
|
CipherKey(const std::string& name);
|
||||||
/// Creates a new CipherKeyImpl object. Autoinitializes key and
|
/// Creates a new CipherKeyImpl object. Autoinitializes key and
|
||||||
/// initialization vector.
|
/// initialization vector.
|
||||||
|
|
||||||
|
CipherKey(const CipherKey& other);
|
||||||
|
/// Copy constructor.
|
||||||
|
|
||||||
|
CipherKey(CipherKey&& other) noexcept;
|
||||||
|
/// Copy constructor.
|
||||||
|
|
||||||
~CipherKey();
|
~CipherKey();
|
||||||
/// Destroys the CipherKeyImpl.
|
/// Destroys the CipherKeyImpl.
|
||||||
|
|
||||||
|
CipherKey& operator = (const CipherKey& other);
|
||||||
|
/// Assignment.
|
||||||
|
|
||||||
|
CipherKey& operator = (CipherKey&& other) noexcept;
|
||||||
|
/// Move assignment.
|
||||||
|
|
||||||
const std::string& name() const;
|
const std::string& name() const;
|
||||||
/// Returns the name of the Cipher.
|
/// Returns the name of the Cipher.
|
||||||
|
|
||||||
@ -107,7 +119,7 @@ public:
|
|||||||
|
|
||||||
Mode mode() const;
|
Mode mode() const;
|
||||||
/// Returns the Cipher's mode of operation.
|
/// Returns the Cipher's mode of operation.
|
||||||
|
|
||||||
const ByteVec& getKey() const;
|
const ByteVec& getKey() const;
|
||||||
/// Returns the key for the Cipher.
|
/// Returns the key for the Cipher.
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class X509Certificate;
|
|||||||
class PKCS12Container;
|
class PKCS12Container;
|
||||||
|
|
||||||
|
|
||||||
class Crypto_API ECKey : public KeyPair
|
class Crypto_API ECKey: public KeyPair
|
||||||
/// This class stores an EC key pair, consisting
|
/// This class stores an EC key pair, consisting
|
||||||
/// of private and public key. Storage of the private
|
/// of private and public key. Storage of the private
|
||||||
/// key is optional.
|
/// key is optional.
|
||||||
@ -73,9 +73,21 @@ public:
|
|||||||
/// If a private key is specified, you don't need to specify a public key file.
|
/// If a private key is specified, you don't need to specify a public key file.
|
||||||
/// OpenSSL will auto-create the public key from the private key.
|
/// OpenSSL will auto-create the public key from the private key.
|
||||||
|
|
||||||
|
ECKey(const ECKey& key);
|
||||||
|
/// Creates the ECKey by copying another one.
|
||||||
|
|
||||||
|
ECKey(ECKey&& key) noexcept;
|
||||||
|
/// Creates the ECKey by moving another one.
|
||||||
|
|
||||||
~ECKey();
|
~ECKey();
|
||||||
/// Destroys the ECKey.
|
/// Destroys the ECKey.
|
||||||
|
|
||||||
|
ECKey& operator = (const ECKey& other);
|
||||||
|
/// Assignment.
|
||||||
|
|
||||||
|
ECKey& operator = (ECKey&& other) noexcept;
|
||||||
|
/// Move assignment.
|
||||||
|
|
||||||
ECKeyImpl::Ptr impl() const;
|
ECKeyImpl::Ptr impl() const;
|
||||||
/// Returns the impl object.
|
/// Returns the impl object.
|
||||||
|
|
||||||
@ -97,9 +109,6 @@ public:
|
|||||||
static bool hasCurve(const std::string& name);
|
static bool hasCurve(const std::string& name);
|
||||||
/// Returns true if the named curve is found,
|
/// Returns true if the named curve is found,
|
||||||
/// false otherwise.
|
/// false otherwise.
|
||||||
|
|
||||||
private:
|
|
||||||
ECKeyImpl::Ptr _pImpl;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +117,7 @@ private:
|
|||||||
//
|
//
|
||||||
inline ECKeyImpl::Ptr ECKey::impl() const
|
inline ECKeyImpl::Ptr ECKey::impl() const
|
||||||
{
|
{
|
||||||
return _pImpl;
|
return KeyPair::impl().cast<ECKeyImpl>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//
|
//
|
||||||
// KeyPair.h
|
// KeyPair.h
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Library: Crypto
|
// Library: Crypto
|
||||||
// Package: CryptoCore
|
// Package: CryptoCore
|
||||||
// Module: KeyPair
|
// Module: KeyPair
|
||||||
@ -48,6 +47,18 @@ public:
|
|||||||
explicit KeyPair(KeyPairImpl::Ptr pKeyPairImpl = 0);
|
explicit KeyPair(KeyPairImpl::Ptr pKeyPairImpl = 0);
|
||||||
/// Extracts the RSA public key from the given certificate.
|
/// Extracts the RSA public key from the given certificate.
|
||||||
|
|
||||||
|
KeyPair(const KeyPair& other);
|
||||||
|
/// Copy constructor.
|
||||||
|
|
||||||
|
KeyPair(KeyPair&& other) noexcept;
|
||||||
|
/// Move constructor.
|
||||||
|
|
||||||
|
KeyPair& operator = (const KeyPair& other);
|
||||||
|
/// Assignment.
|
||||||
|
|
||||||
|
KeyPair& operator = (KeyPair&& other) noexcept;
|
||||||
|
/// Move assignment.
|
||||||
|
|
||||||
virtual ~KeyPair();
|
virtual ~KeyPair();
|
||||||
/// Destroys the KeyPair.
|
/// Destroys the KeyPair.
|
||||||
|
|
||||||
@ -57,7 +68,7 @@ public:
|
|||||||
virtual void save(const std::string& publicKeyPairFile,
|
virtual void save(const std::string& publicKeyPairFile,
|
||||||
const std::string& privateKeyPairFile = "",
|
const std::string& privateKeyPairFile = "",
|
||||||
const std::string& privateKeyPairPassphrase = "") const;
|
const std::string& privateKeyPairPassphrase = "") const;
|
||||||
/// Exports the public and private keys to the given files.
|
/// Exports the public and private keys to the given files.
|
||||||
///
|
///
|
||||||
/// If an empty filename is specified, the corresponding key
|
/// If an empty filename is specified, the corresponding key
|
||||||
/// is not exported.
|
/// is not exported.
|
||||||
@ -78,7 +89,7 @@ public:
|
|||||||
|
|
||||||
Type type() const;
|
Type type() const;
|
||||||
/// Returns key pair type
|
/// Returns key pair type
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KeyPairImpl::Ptr _pImpl;
|
KeyPairImpl::Ptr _pImpl;
|
||||||
};
|
};
|
||||||
@ -87,7 +98,6 @@ private:
|
|||||||
//
|
//
|
||||||
// inlines
|
// inlines
|
||||||
//
|
//
|
||||||
|
|
||||||
inline int KeyPair::size() const
|
inline int KeyPair::size() const
|
||||||
{
|
{
|
||||||
return _pImpl->size();
|
return _pImpl->size();
|
||||||
@ -115,6 +125,7 @@ inline const std::string& KeyPair::name() const
|
|||||||
return _pImpl->name();
|
return _pImpl->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline KeyPairImpl::Ptr KeyPair::impl() const
|
inline KeyPairImpl::Ptr KeyPair::impl() const
|
||||||
{
|
{
|
||||||
return _pImpl;
|
return _pImpl;
|
||||||
|
@ -31,7 +31,7 @@ class X509Certificate;
|
|||||||
class PKCS12Container;
|
class PKCS12Container;
|
||||||
|
|
||||||
|
|
||||||
class Crypto_API RSAKey : public KeyPair
|
class Crypto_API RSAKey: public KeyPair
|
||||||
/// This class stores an RSA key pair, consisting
|
/// This class stores an RSA key pair, consisting
|
||||||
/// of private and public key. Storage of the private
|
/// of private and public key. Storage of the private
|
||||||
/// key is optional.
|
/// key is optional.
|
||||||
@ -90,9 +90,21 @@ public:
|
|||||||
/// If a private key is specified, you don't need to specify a public key file.
|
/// If a private key is specified, you don't need to specify a public key file.
|
||||||
/// OpenSSL will auto-create the public key from the private key.
|
/// OpenSSL will auto-create the public key from the private key.
|
||||||
|
|
||||||
|
RSAKey(const RSAKey& other);
|
||||||
|
/// Copy constructor.
|
||||||
|
|
||||||
|
RSAKey(RSAKey&& other) noexcept;
|
||||||
|
/// Move constructor.
|
||||||
|
|
||||||
~RSAKey();
|
~RSAKey();
|
||||||
/// Destroys the RSAKey.
|
/// Destroys the RSAKey.
|
||||||
|
|
||||||
|
RSAKey& operator = (const RSAKey& other);
|
||||||
|
/// Assignment.
|
||||||
|
|
||||||
|
RSAKey& operator = (RSAKey&& other) noexcept;
|
||||||
|
/// Move assignment.
|
||||||
|
|
||||||
RSAKeyImpl::ByteVec modulus() const;
|
RSAKeyImpl::ByteVec modulus() const;
|
||||||
/// Returns the RSA modulus.
|
/// Returns the RSA modulus.
|
||||||
|
|
||||||
@ -104,9 +116,6 @@ public:
|
|||||||
|
|
||||||
RSAKeyImpl::Ptr impl() const;
|
RSAKeyImpl::Ptr impl() const;
|
||||||
/// Returns the impl object.
|
/// Returns the impl object.
|
||||||
|
|
||||||
private:
|
|
||||||
RSAKeyImpl::Ptr _pImpl;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +124,7 @@ private:
|
|||||||
//
|
//
|
||||||
inline RSAKeyImpl::Ptr RSAKey::impl() const
|
inline RSAKeyImpl::Ptr RSAKey::impl() const
|
||||||
{
|
{
|
||||||
return _pImpl;
|
return KeyPair::impl().cast<RSAKeyImpl>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,9 +41,38 @@ CipherKey::CipherKey(const std::string& name):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CipherKey::CipherKey(const CipherKey& other):
|
||||||
|
_pImpl(other._pImpl)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CipherKey::CipherKey(CipherKey&& other) noexcept:
|
||||||
|
_pImpl(std::move(other._pImpl))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CipherKey::~CipherKey()
|
CipherKey::~CipherKey()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CipherKey& CipherKey::operator = (const CipherKey& other)
|
||||||
|
{
|
||||||
|
if (&other != this)
|
||||||
|
{
|
||||||
|
_pImpl = other._pImpl;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CipherKey& CipherKey::operator = (CipherKey&& other) noexcept
|
||||||
|
{
|
||||||
|
_pImpl = std::move(other._pImpl);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Crypto
|
} } // namespace Poco::Crypto
|
||||||
|
@ -22,47 +22,49 @@ namespace Crypto {
|
|||||||
|
|
||||||
|
|
||||||
ECKey::ECKey(const EVPPKey& key):
|
ECKey::ECKey(const EVPPKey& key):
|
||||||
KeyPair(new ECKeyImpl(key)),
|
KeyPair(new ECKeyImpl(key))
|
||||||
_pImpl(KeyPair::impl().cast<ECKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ECKey::ECKey(const X509Certificate& cert):
|
ECKey::ECKey(const X509Certificate& cert):
|
||||||
KeyPair(new ECKeyImpl(cert)),
|
KeyPair(new ECKeyImpl(cert))
|
||||||
_pImpl(KeyPair::impl().cast<ECKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ECKey::ECKey(const PKCS12Container& cont):
|
ECKey::ECKey(const PKCS12Container& cont):
|
||||||
KeyPair(new ECKeyImpl(cont)),
|
KeyPair(new ECKeyImpl(cont))
|
||||||
_pImpl(KeyPair::impl().cast<ECKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ECKey::ECKey(const std::string& eccGroup):
|
ECKey::ECKey(const std::string& eccGroup):
|
||||||
KeyPair(new ECKeyImpl(OBJ_txt2nid(eccGroup.c_str()))),
|
KeyPair(new ECKeyImpl(OBJ_txt2nid(eccGroup.c_str())))
|
||||||
_pImpl(KeyPair::impl().cast<ECKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ECKey::ECKey(const std::string& publicKeyFile,
|
ECKey::ECKey(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase):
|
||||||
const std::string& privateKeyFile,
|
KeyPair(new ECKeyImpl(publicKeyFile, privateKeyFile, privateKeyPassphrase))
|
||||||
const std::string& privateKeyPassphrase):
|
|
||||||
KeyPair(new ECKeyImpl(publicKeyFile, privateKeyFile, privateKeyPassphrase)),
|
|
||||||
_pImpl(KeyPair::impl().cast<ECKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ECKey::ECKey(std::istream* pPublicKeyStream,
|
ECKey::ECKey(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase):
|
||||||
std::istream* pPrivateKeyStream,
|
KeyPair(new ECKeyImpl(pPublicKeyStream, pPrivateKeyStream, privateKeyPassphrase))
|
||||||
const std::string& privateKeyPassphrase):
|
{
|
||||||
KeyPair(new ECKeyImpl(pPublicKeyStream, pPrivateKeyStream, privateKeyPassphrase)),
|
}
|
||||||
_pImpl(KeyPair::impl().cast<ECKeyImpl>())
|
|
||||||
|
|
||||||
|
ECKey::ECKey(const ECKey& other):
|
||||||
|
KeyPair(other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ECKey::ECKey(ECKey&& other) noexcept:
|
||||||
|
KeyPair(std::move(other))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,4 +74,18 @@ ECKey::~ECKey()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ECKey& ECKey::operator = (const ECKey& other)
|
||||||
|
{
|
||||||
|
KeyPair::operator = (other);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ECKey& ECKey::operator = (ECKey&& other) noexcept
|
||||||
|
{
|
||||||
|
KeyPair::operator = (std::move(other));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Crypto
|
} } // namespace Poco::Crypto
|
||||||
|
@ -89,11 +89,10 @@ EVPPKey::EVPPKey(const EVPPKey& other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EVPPKey::EVPPKey(EVPPKey&& other) noexcept:
|
EVPPKey::EVPPKey(EVPPKey&& other) noexcept:
|
||||||
_pEVPPKey(other._pEVPPKey)
|
_pEVPPKey(other._pEVPPKey)
|
||||||
{
|
{
|
||||||
other._pEVPPKey = nullptr;
|
other._pEVPPKey = nullptr;
|
||||||
poco_check_ptr(_pEVPPKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -109,7 +108,6 @@ EVPPKey& EVPPKey::operator = (EVPPKey&& other) noexcept
|
|||||||
{
|
{
|
||||||
_pEVPPKey = other._pEVPPKey;
|
_pEVPPKey = other._pEVPPKey;
|
||||||
other._pEVPPKey = nullptr;
|
other._pEVPPKey = nullptr;
|
||||||
poco_check_ptr(_pEVPPKey);
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//
|
//
|
||||||
// KeyPair.cpp
|
// KeyPair.cpp
|
||||||
//
|
//
|
||||||
//
|
|
||||||
// Library: Crypto
|
// Library: Crypto
|
||||||
// Package: CryptoCore
|
// Package: CryptoCore
|
||||||
// Module: KeyPair
|
// Module: KeyPair
|
||||||
@ -21,7 +20,20 @@ namespace Poco {
|
|||||||
namespace Crypto {
|
namespace Crypto {
|
||||||
|
|
||||||
|
|
||||||
KeyPair::KeyPair(KeyPairImpl::Ptr pKeyPairImpl): _pImpl(pKeyPairImpl)
|
KeyPair::KeyPair(KeyPairImpl::Ptr pKeyPairImpl):
|
||||||
|
_pImpl(pKeyPairImpl)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KeyPair::KeyPair(const KeyPair& other):
|
||||||
|
_pImpl(other._pImpl)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KeyPair::KeyPair(KeyPair&& other) noexcept:
|
||||||
|
_pImpl(std::move(other._pImpl))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,4 +43,21 @@ KeyPair::~KeyPair()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KeyPair& KeyPair::operator = (const KeyPair& other)
|
||||||
|
{
|
||||||
|
if (&other != this)
|
||||||
|
{
|
||||||
|
_pImpl = other._pImpl;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
KeyPair& KeyPair::operator = (KeyPair&& other) noexcept
|
||||||
|
{
|
||||||
|
_pImpl = std::move(other._pImpl);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Crypto
|
} } // namespace Poco::Crypto
|
||||||
|
@ -73,6 +73,17 @@ PKCS12Container::PKCS12Container(const PKCS12Container& other):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PKCS12Container::PKCS12Container(PKCS12Container&& other) noexcept:
|
||||||
|
_pKey(other._pKey),
|
||||||
|
_pX509Cert(std::move(other._pX509Cert)),
|
||||||
|
_caCertList(std::move(other._caCertList)),
|
||||||
|
_caCertNames(std::move(other._caCertNames)),
|
||||||
|
_pkcsFriendlyName(std::move(other._pkcsFriendlyName))
|
||||||
|
{
|
||||||
|
other._pKey = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PKCS12Container& PKCS12Container::operator = (const PKCS12Container& other)
|
PKCS12Container& PKCS12Container::operator = (const PKCS12Container& other)
|
||||||
{
|
{
|
||||||
if (&other != this)
|
if (&other != this)
|
||||||
@ -88,17 +99,6 @@ PKCS12Container& PKCS12Container::operator = (const PKCS12Container& other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PKCS12Container::PKCS12Container(PKCS12Container&& other) noexcept:
|
|
||||||
_pKey(other._pKey),
|
|
||||||
_pX509Cert(std::move(other._pX509Cert)),
|
|
||||||
_caCertList(std::move(other._caCertList)),
|
|
||||||
_caCertNames(std::move(other._caCertNames)),
|
|
||||||
_pkcsFriendlyName(std::move(other._pkcsFriendlyName))
|
|
||||||
{
|
|
||||||
other._pKey = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PKCS12Container& PKCS12Container::operator = (PKCS12Container&& other) noexcept
|
PKCS12Container& PKCS12Container::operator = (PKCS12Container&& other) noexcept
|
||||||
{
|
{
|
||||||
if (_pKey) EVP_PKEY_free(_pKey);
|
if (_pKey) EVP_PKEY_free(_pKey);
|
||||||
|
@ -21,43 +21,49 @@ namespace Crypto {
|
|||||||
|
|
||||||
|
|
||||||
RSAKey::RSAKey(const EVPPKey& key):
|
RSAKey::RSAKey(const EVPPKey& key):
|
||||||
KeyPair(new RSAKeyImpl(key)),
|
KeyPair(new RSAKeyImpl(key))
|
||||||
_pImpl(KeyPair::impl().cast<RSAKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RSAKey::RSAKey(const X509Certificate& cert):
|
RSAKey::RSAKey(const X509Certificate& cert):
|
||||||
KeyPair(new RSAKeyImpl(cert)),
|
KeyPair(new RSAKeyImpl(cert))
|
||||||
_pImpl(KeyPair::impl().cast<RSAKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RSAKey::RSAKey(const PKCS12Container& cont):
|
RSAKey::RSAKey(const PKCS12Container& cont):
|
||||||
KeyPair(new RSAKeyImpl(cont)),
|
KeyPair(new RSAKeyImpl(cont))
|
||||||
_pImpl(KeyPair::impl().cast<RSAKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RSAKey::RSAKey(KeyLength keyLength, Exponent exp):
|
RSAKey::RSAKey(KeyLength keyLength, Exponent exp):
|
||||||
KeyPair(new RSAKeyImpl(keyLength, (exp == EXP_LARGE) ? RSA_F4 : RSA_3)),
|
KeyPair(new RSAKeyImpl(keyLength, (exp == EXP_LARGE) ? RSA_F4 : RSA_3))
|
||||||
_pImpl(KeyPair::impl().cast<RSAKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RSAKey::RSAKey(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase):
|
RSAKey::RSAKey(const std::string& publicKeyFile, const std::string& privateKeyFile, const std::string& privateKeyPassphrase):
|
||||||
KeyPair(new RSAKeyImpl(publicKeyFile, privateKeyFile, privateKeyPassphrase)),
|
KeyPair(new RSAKeyImpl(publicKeyFile, privateKeyFile, privateKeyPassphrase))
|
||||||
_pImpl(KeyPair::impl().cast<RSAKeyImpl>())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RSAKey::RSAKey(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase):
|
RSAKey::RSAKey(std::istream* pPublicKeyStream, std::istream* pPrivateKeyStream, const std::string& privateKeyPassphrase):
|
||||||
KeyPair(new RSAKeyImpl(pPublicKeyStream, pPrivateKeyStream, privateKeyPassphrase)),
|
KeyPair(new RSAKeyImpl(pPublicKeyStream, pPrivateKeyStream, privateKeyPassphrase))
|
||||||
_pImpl(KeyPair::impl().cast<RSAKeyImpl>())
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RSAKey::RSAKey(const RSAKey& other):
|
||||||
|
KeyPair(other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RSAKey::RSAKey(RSAKey&& other) noexcept:
|
||||||
|
KeyPair(std::move(other))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,22 +72,37 @@ RSAKey::~RSAKey()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RSAKey& RSAKey::operator = (const RSAKey& other)
|
||||||
|
{
|
||||||
|
KeyPair::operator = (other);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RSAKey& RSAKey::operator = (RSAKey&& other) noexcept
|
||||||
|
{
|
||||||
|
KeyPair::operator = (std::move(other));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RSAKeyImpl::ByteVec RSAKey::modulus() const
|
RSAKeyImpl::ByteVec RSAKey::modulus() const
|
||||||
{
|
{
|
||||||
return _pImpl->modulus();
|
return impl()->modulus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RSAKeyImpl::ByteVec RSAKey::encryptionExponent() const
|
RSAKeyImpl::ByteVec RSAKey::encryptionExponent() const
|
||||||
{
|
{
|
||||||
return _pImpl->encryptionExponent();
|
return impl()->encryptionExponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RSAKeyImpl::ByteVec RSAKey::decryptionExponent() const
|
RSAKeyImpl::ByteVec RSAKey::decryptionExponent() const
|
||||||
{
|
{
|
||||||
return _pImpl->decryptionExponent();
|
return impl()->decryptionExponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Crypto
|
} } // namespace Poco::Crypto
|
||||||
|
@ -29,12 +29,14 @@
|
|||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
#include <openssl/bn.h>
|
#include <openssl/bn.h>
|
||||||
|
|
||||||
|
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
#define ASN1_STRING_get0_data ASN1_STRING_data
|
#define ASN1_STRING_get0_data ASN1_STRING_data
|
||||||
#define X509_get0_notBefore X509_get_notBefore
|
#define X509_get0_notBefore X509_get_notBefore
|
||||||
#define X509_get0_notAfter X509_get_notAfter
|
#define X509_get0_notAfter X509_get_notAfter
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
namespace Crypto {
|
namespace Crypto {
|
||||||
|
|
||||||
@ -113,6 +115,7 @@ X509Certificate& X509Certificate::operator = (X509Certificate&& cert) noexcept
|
|||||||
_issuerName = std::move(cert._issuerName);
|
_issuerName = std::move(cert._issuerName);
|
||||||
_subjectName = std::move(cert._subjectName);
|
_subjectName = std::move(cert._subjectName);
|
||||||
_serialNumber = std::move(cert._serialNumber);
|
_serialNumber = std::move(cert._serialNumber);
|
||||||
|
if (_pCert) X509_free(_pCert);
|
||||||
_pCert = cert._pCert; cert._pCert = nullptr;
|
_pCert = cert._pCert; cert._pCert = nullptr;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ MetaColumn::MetaColumn(std::size_t position,
|
|||||||
ColumnDataType type,
|
ColumnDataType type,
|
||||||
std::size_t length,
|
std::size_t length,
|
||||||
std::size_t precision,
|
std::size_t precision,
|
||||||
bool nullable):
|
bool nullable):
|
||||||
_name(name),
|
_name(name),
|
||||||
_length(length),
|
_length(length),
|
||||||
_precision(precision),
|
_precision(precision),
|
||||||
@ -91,6 +91,7 @@ MetaColumn& MetaColumn::operator = (MetaColumn&& other) noexcept
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MetaColumn::swap(MetaColumn& other)
|
void MetaColumn::swap(MetaColumn& other)
|
||||||
{
|
{
|
||||||
std::swap(_name, other._name);
|
std::swap(_name, other._name);
|
||||||
|
@ -48,16 +48,16 @@ Session::Session(const std::string& connection,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Session::Session(const Session& other):
|
Session::Session(const Session& other):
|
||||||
_pImpl(other._pImpl),
|
_pImpl(other._pImpl),
|
||||||
_statementCreator(other._pImpl)
|
_statementCreator(other._statementCreator)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Session::Session(Session&& other) noexcept:
|
Session::Session(Session&& other) noexcept:
|
||||||
_pImpl(std::move(other._pImpl)),
|
_pImpl(std::move(other._pImpl)),
|
||||||
_statementCreator(std::move(other._pImpl))
|
_statementCreator(std::move(other._statementCreator))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,109 +54,109 @@ public:
|
|||||||
PRIO_DEBUG, /// A debugging message.
|
PRIO_DEBUG, /// A debugging message.
|
||||||
PRIO_TRACE /// A tracing message. This is the lowest priority.
|
PRIO_TRACE /// A tracing message. This is the lowest priority.
|
||||||
};
|
};
|
||||||
|
|
||||||
Message();
|
Message();
|
||||||
/// Creates an empty Message.
|
/// Creates an empty Message.
|
||||||
/// The thread and process ids are set.
|
/// The thread and process ids are set.
|
||||||
|
|
||||||
Message(const std::string& source, const std::string& text, Priority prio);
|
Message(const std::string& source, const std::string& text, Priority prio);
|
||||||
/// Creates a Message with the given source, text and priority.
|
/// Creates a Message with the given source, text and priority.
|
||||||
/// The thread and process ids are set.
|
/// The thread and process ids are set.
|
||||||
|
|
||||||
Message(const std::string& source, const std::string& text, Priority prio, const char* file, int line);
|
Message(const std::string& source, const std::string& text, Priority prio, const char* file, int line);
|
||||||
/// Creates a Message with the given source, text, priority,
|
/// Creates a Message with the given source, text, priority,
|
||||||
/// source file path and line.
|
/// source file path and line.
|
||||||
///
|
///
|
||||||
/// The source file path must be a
|
/// The source file path must be a
|
||||||
/// static string with a lifetime that's at least the lifetime
|
/// static string with a lifetime that's at least the lifetime
|
||||||
/// of the message object (the string is not copied internally).
|
/// of the message object (the string is not copied internally).
|
||||||
/// Usually, this will be the path string obtained from the
|
/// Usually, this will be the path string obtained from the
|
||||||
/// __FILE__ macro.
|
/// __FILE__ macro.
|
||||||
///
|
///
|
||||||
/// The thread and process ids are set.
|
/// The thread and process ids are set.
|
||||||
|
|
||||||
Message(const Message& msg);
|
Message(const Message& msg);
|
||||||
/// Creates a Message by copying another one.
|
/// Creates a Message by copying another one.
|
||||||
|
|
||||||
Message(Message&& msg);
|
Message(Message&& msg) noexcept;
|
||||||
/// Creates a Message by copying another one.
|
/// Creates a Message by copying another one.
|
||||||
|
|
||||||
Message(const Message& msg, const std::string& text);
|
Message(const Message& msg, const std::string& text);
|
||||||
/// Creates a Message by copying all but the text from another message.
|
/// Creates a Message by copying all but the text from another message.
|
||||||
|
|
||||||
~Message();
|
~Message();
|
||||||
/// Destroys the Message.
|
/// Destroys the Message.
|
||||||
|
|
||||||
Message& operator = (const Message& msg);
|
Message& operator = (const Message& msg);
|
||||||
/// Assignment operator.
|
/// Assignment operator.
|
||||||
|
|
||||||
Message& operator = (Message&& msg);
|
Message& operator = (Message&& msg) noexcept;
|
||||||
/// Assignment operator.
|
/// Assignment operator.
|
||||||
|
|
||||||
void swap(Message& msg);
|
void swap(Message& msg);
|
||||||
/// Swaps the message with another one.
|
/// Swaps the message with another one.
|
||||||
|
|
||||||
void setSource(const std::string& src);
|
void setSource(const std::string& src);
|
||||||
/// Sets the source of the message.
|
/// Sets the source of the message.
|
||||||
|
|
||||||
const std::string& getSource() const;
|
const std::string& getSource() const;
|
||||||
/// Returns the source of the message.
|
/// Returns the source of the message.
|
||||||
|
|
||||||
void setText(const std::string& text);
|
void setText(const std::string& text);
|
||||||
/// Sets the text of the message.
|
/// Sets the text of the message.
|
||||||
|
|
||||||
const std::string& getText() const;
|
const std::string& getText() const;
|
||||||
/// Returns the text of the message.
|
/// Returns the text of the message.
|
||||||
|
|
||||||
void setPriority(Priority prio);
|
void setPriority(Priority prio);
|
||||||
/// Sets the priority of the message.
|
/// Sets the priority of the message.
|
||||||
|
|
||||||
Priority getPriority() const;
|
Priority getPriority() const;
|
||||||
/// Returns the priority of the message.
|
/// Returns the priority of the message.
|
||||||
|
|
||||||
void setTime(const Timestamp& time);
|
void setTime(const Timestamp& time);
|
||||||
/// Sets the time of the message.
|
/// Sets the time of the message.
|
||||||
|
|
||||||
const Timestamp& getTime() const;
|
const Timestamp& getTime() const;
|
||||||
/// Returns the time of the message.
|
/// Returns the time of the message.
|
||||||
|
|
||||||
void setThread(const std::string& thread);
|
void setThread(const std::string& thread);
|
||||||
/// Sets the thread identifier for the message.
|
/// Sets the thread identifier for the message.
|
||||||
|
|
||||||
const std::string& getThread() const;
|
const std::string& getThread() const;
|
||||||
/// Returns the thread identifier for the message.
|
/// Returns the thread identifier for the message.
|
||||||
|
|
||||||
void setTid(long pid);
|
void setTid(long pid);
|
||||||
/// Sets the numeric thread identifier for the message.
|
/// Sets the numeric thread identifier for the message.
|
||||||
|
|
||||||
long getTid() const;
|
long getTid() const;
|
||||||
/// Returns the numeric thread identifier for the message.
|
/// Returns the numeric thread identifier for the message.
|
||||||
|
|
||||||
void setPid(long pid);
|
void setPid(long pid);
|
||||||
/// Sets the process identifier for the message.
|
/// Sets the process identifier for the message.
|
||||||
|
|
||||||
long getPid() const;
|
long getPid() const;
|
||||||
/// Returns the process identifier for the message.
|
/// Returns the process identifier for the message.
|
||||||
|
|
||||||
void setSourceFile(const char* file);
|
void setSourceFile(const char* file);
|
||||||
/// Sets the source file path of the statement
|
/// Sets the source file path of the statement
|
||||||
/// generating the log message.
|
/// generating the log message.
|
||||||
///
|
///
|
||||||
/// File must be a static string, such as the value of
|
/// File must be a static string, such as the value of
|
||||||
/// the __FILE__ macro. The string is not copied
|
/// the __FILE__ macro. The string is not copied
|
||||||
/// internally for performance reasons.
|
/// internally for performance reasons.
|
||||||
|
|
||||||
const char* getSourceFile() const;
|
const char* getSourceFile() const;
|
||||||
/// Returns the source file path of the code creating
|
/// Returns the source file path of the code creating
|
||||||
/// the message. May be 0 if not set.
|
/// the message. May be 0 if not set.
|
||||||
|
|
||||||
void setSourceLine(int line);
|
void setSourceLine(int line);
|
||||||
/// Sets the source file line of the statement
|
/// Sets the source file line of the statement
|
||||||
/// generating the log message.
|
/// generating the log message.
|
||||||
///
|
///
|
||||||
/// This is usually the result of the __LINE__
|
/// This is usually the result of the __LINE__
|
||||||
/// macro.
|
/// macro.
|
||||||
|
|
||||||
int getSourceLine() const;
|
int getSourceLine() const;
|
||||||
/// Returns the source file line of the statement
|
/// Returns the source file line of the statement
|
||||||
/// generating the log message. May be 0
|
/// generating the log message. May be 0
|
||||||
@ -183,7 +183,7 @@ public:
|
|||||||
/// Returns a const reference to the value of the parameter
|
/// Returns a const reference to the value of the parameter
|
||||||
/// with the given name. Throws a NotFoundException if the
|
/// with the given name. Throws a NotFoundException if the
|
||||||
/// parameter does not exist.
|
/// parameter does not exist.
|
||||||
|
|
||||||
std::string& operator [] (const std::string& param);
|
std::string& operator [] (const std::string& param);
|
||||||
/// Returns a reference to the value of the parameter with the
|
/// Returns a reference to the value of the parameter with the
|
||||||
/// given name. This can be used to set the parameter's value.
|
/// given name. This can be used to set the parameter's value.
|
||||||
@ -194,7 +194,7 @@ protected:
|
|||||||
void init();
|
void init();
|
||||||
typedef std::map<std::string, std::string> StringMap;
|
typedef std::map<std::string, std::string> StringMap;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _source;
|
std::string _source;
|
||||||
std::string _text;
|
std::string _text;
|
||||||
Priority _prio;
|
Priority _prio;
|
||||||
|
@ -24,41 +24,41 @@
|
|||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
|
|
||||||
Message::Message():
|
Message::Message():
|
||||||
_prio(PRIO_FATAL),
|
_prio(PRIO_FATAL),
|
||||||
_tid(0),
|
_tid(0),
|
||||||
_pid(0),
|
_pid(0),
|
||||||
_file(0),
|
_file(0),
|
||||||
_line(0),
|
_line(0),
|
||||||
_pMap(0)
|
_pMap(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Message::Message(const std::string& source, const std::string& text, Priority prio):
|
Message::Message(const std::string& source, const std::string& text, Priority prio):
|
||||||
_source(source),
|
_source(source),
|
||||||
_text(text),
|
_text(text),
|
||||||
_prio(prio),
|
_prio(prio),
|
||||||
_tid(0),
|
_tid(0),
|
||||||
_pid(0),
|
_pid(0),
|
||||||
_file(0),
|
_file(0),
|
||||||
_line(0),
|
_line(0),
|
||||||
_pMap(0)
|
_pMap(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Message::Message(const std::string& source, const std::string& text, Priority prio, const char* file, int line):
|
Message::Message(const std::string& source, const std::string& text, Priority prio, const char* file, int line):
|
||||||
_source(source),
|
_source(source),
|
||||||
_text(text),
|
_text(text),
|
||||||
_prio(prio),
|
_prio(prio),
|
||||||
_tid(0),
|
_tid(0),
|
||||||
_pid(0),
|
_pid(0),
|
||||||
_file(file),
|
_file(file),
|
||||||
_line(line),
|
_line(line),
|
||||||
_pMap(0)
|
_pMap(0)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ Message::Message(const Message& msg):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Message::Message(Message&& msg) :
|
Message::Message(Message&& msg) noexcept:
|
||||||
_source(std::move(msg._source)),
|
_source(std::move(msg._source)),
|
||||||
_text(std::move(msg._text)),
|
_text(std::move(msg._text)),
|
||||||
_prio(std::move(msg._prio)),
|
_prio(std::move(msg._prio)),
|
||||||
@ -147,23 +147,20 @@ Message& Message::operator = (const Message& msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Message& Message::operator = (Message&& msg)
|
Message& Message::operator = (Message&& msg) noexcept
|
||||||
{
|
{
|
||||||
if (&msg != this)
|
_source = std::move(msg._source);
|
||||||
{
|
_text = std::move(msg._text);
|
||||||
_source = std::move(msg._source);
|
_prio = std::move(msg._prio);
|
||||||
_text = std::move(msg._text);
|
_time = std::move(msg._time);
|
||||||
_prio = std::move(msg._prio);
|
_tid = std::move(msg._tid);
|
||||||
_time = std::move(msg._time);
|
_thread = std::move(msg._thread);
|
||||||
_tid = std::move(msg._tid);
|
_pid = std::move(msg._pid);
|
||||||
_thread = std::move(msg._thread);
|
_file = std::move(msg._file);
|
||||||
_pid = std::move(msg._pid);
|
_line = std::move(msg._line);
|
||||||
_file = std::move(msg._file);
|
delete _pMap;
|
||||||
_line = std::move(msg._line);
|
_pMap = msg._pMap;
|
||||||
delete _pMap;
|
msg._pMap = nullptr;
|
||||||
_pMap = msg._pMap;
|
|
||||||
msg._pMap = nullptr;
|
|
||||||
}
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,16 +73,16 @@ public:
|
|||||||
Array(const Array& copy);
|
Array(const Array& copy);
|
||||||
/// Creates an Array by copying another one.
|
/// Creates an Array by copying another one.
|
||||||
|
|
||||||
Array(Array&& other);
|
Array(Array&& other) noexcept;
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
||||||
Array& operator=(Array&& other);
|
Array& operator = (const Array& other);
|
||||||
/// Move assignment operator.
|
|
||||||
|
|
||||||
Array& operator=(const Array& other);
|
|
||||||
/// Assignment operator.
|
/// Assignment operator.
|
||||||
|
|
||||||
virtual ~Array();
|
Array& operator = (Array&& other) noexcept;
|
||||||
|
/// Move assignment operator.
|
||||||
|
|
||||||
|
~Array();
|
||||||
/// Destroys the Array.
|
/// Destroys the Array.
|
||||||
|
|
||||||
void setEscapeUnicode(bool escape = true);
|
void setEscapeUnicode(bool escape = true);
|
||||||
|
@ -84,18 +84,18 @@ public:
|
|||||||
/// Struct is not copied to keep the operation as
|
/// Struct is not copied to keep the operation as
|
||||||
/// efficient as possible (when needed, it will be generated upon request).
|
/// efficient as possible (when needed, it will be generated upon request).
|
||||||
|
|
||||||
Object(Object&& other);
|
Object(Object&& other) noexcept;
|
||||||
/// Move constructor
|
/// Move constructor
|
||||||
|
|
||||||
Object &operator =(Object &&other);
|
~Object();
|
||||||
// Move asignment operator
|
|
||||||
|
|
||||||
virtual ~Object();
|
|
||||||
/// Destroys the Object.
|
/// Destroys the Object.
|
||||||
|
|
||||||
Object &operator =(const Object &other);
|
Object &operator = (const Object &other);
|
||||||
// Assignment operator
|
// Assignment operator
|
||||||
|
|
||||||
|
Object &operator = (Object &&other) noexcept;
|
||||||
|
// Move asignment operator
|
||||||
|
|
||||||
void setEscapeUnicode(bool escape = true);
|
void setEscapeUnicode(bool escape = true);
|
||||||
/// Sets the flag for escaping unicode.
|
/// Sets the flag for escaping unicode.
|
||||||
|
|
||||||
|
@ -25,46 +25,50 @@ namespace Poco {
|
|||||||
namespace JSON {
|
namespace JSON {
|
||||||
|
|
||||||
|
|
||||||
Array::Array(int options): _modified(false),
|
Array::Array(int options):
|
||||||
|
_modified(false),
|
||||||
_escapeUnicode((options & Poco::JSON_ESCAPE_UNICODE) != 0)
|
_escapeUnicode((options & Poco::JSON_ESCAPE_UNICODE) != 0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Array::Array(const Array& other) : _values(other._values),
|
Array::Array(const Array& other) :
|
||||||
|
_values(other._values),
|
||||||
_pArray(other._pArray),
|
_pArray(other._pArray),
|
||||||
_modified(other._modified)
|
_modified(other._modified),
|
||||||
|
_escapeUnicode(other._escapeUnicode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Array &Array::operator=(const Array& other)
|
Array::Array(Array&& other) noexcept:
|
||||||
|
_values(std::move(other._values)),
|
||||||
|
_pArray(std::move(other._pArray)),
|
||||||
|
_modified(other._modified),
|
||||||
|
_escapeUnicode(other._escapeUnicode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Array& Array::operator = (const Array& other)
|
||||||
{
|
{
|
||||||
if (&other != this)
|
if (&other != this)
|
||||||
{
|
{
|
||||||
_values = other._values;
|
_values = other._values;
|
||||||
_pArray = other._pArray;
|
_pArray = other._pArray;
|
||||||
_modified = other._modified;
|
_modified = other._modified;
|
||||||
|
_escapeUnicode = other._escapeUnicode;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Array::Array(Array&& other):
|
Array& Array::operator = (Array&& other) noexcept
|
||||||
_values(std::move(other._values)),
|
|
||||||
_pArray(!other._modified ? other._pArray : 0),
|
|
||||||
_modified(other._modified)
|
|
||||||
{
|
|
||||||
_pArray = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Array &Array::operator = (Array&& other)
|
|
||||||
{
|
{
|
||||||
_values = std::move(other._values);
|
_values = std::move(other._values);
|
||||||
_pArray = other._pArray;
|
_pArray = std::move(other._pArray);
|
||||||
other._pArray = 0;
|
|
||||||
_modified = other._modified;
|
_modified = other._modified;
|
||||||
|
_escapeUnicode = other._escapeUnicode;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
@ -42,29 +42,15 @@ Object::Object(const Object& other) : _values(other._values),
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Object::Object(Object&& other):
|
Object::Object(Object&& other) noexcept:
|
||||||
_values(std::move(other._values)),
|
_values(std::move(other._values)),
|
||||||
_keys(std::move(other._keys)),
|
_keys(std::move(other._keys)),
|
||||||
_preserveInsOrder(other._preserveInsOrder),
|
_preserveInsOrder(other._preserveInsOrder),
|
||||||
_escapeUnicode(other._escapeUnicode),
|
_escapeUnicode(other._escapeUnicode),
|
||||||
_pStruct(!other._modified ? other._pStruct : 0),
|
_pStruct(std::move(other._pStruct)),
|
||||||
|
_pOrdStruct(std::move(other._pOrdStruct)),
|
||||||
_modified(other._modified)
|
_modified(other._modified)
|
||||||
{
|
{
|
||||||
other.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Object &Object::operator = (Object&& other)
|
|
||||||
{
|
|
||||||
_values = other._values;
|
|
||||||
_preserveInsOrder = other._preserveInsOrder;
|
|
||||||
syncKeys(other._keys);
|
|
||||||
_escapeUnicode = other._escapeUnicode;
|
|
||||||
_pStruct = !other._modified ? other._pStruct : 0;
|
|
||||||
_modified = other._modified;
|
|
||||||
other.clear();
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +59,7 @@ Object::~Object()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Object &Object::operator= (const Object &other)
|
Object &Object::operator = (const Object &other)
|
||||||
{
|
{
|
||||||
if (&other != this)
|
if (&other != this)
|
||||||
{
|
{
|
||||||
@ -88,6 +74,20 @@ Object &Object::operator= (const Object &other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Object& Object::operator = (Object&& other) noexcept
|
||||||
|
{
|
||||||
|
_values = std::move(other._values);
|
||||||
|
_keys = std::move(other._keys);
|
||||||
|
_preserveInsOrder = other._preserveInsOrder;
|
||||||
|
_escapeUnicode = other._escapeUnicode;
|
||||||
|
_pStruct = std::move(other._pStruct);
|
||||||
|
_pOrdStruct = std::move(other._pOrdStruct);
|
||||||
|
_modified = other._modified;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Object::syncKeys(const KeyList& keys)
|
void Object::syncKeys(const KeyList& keys)
|
||||||
{
|
{
|
||||||
if(_preserveInsOrder)
|
if(_preserveInsOrder)
|
||||||
|
@ -33,7 +33,7 @@ namespace Net {
|
|||||||
|
|
||||||
X509Certificate::X509Certificate(std::istream& istr):
|
X509Certificate::X509Certificate(std::istream& istr):
|
||||||
Poco::Crypto::X509Certificate(istr)
|
Poco::Crypto::X509Certificate(istr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +91,7 @@ X509Certificate& X509Certificate::operator = (const X509Certificate& cert)
|
|||||||
|
|
||||||
X509Certificate& X509Certificate::operator = (X509Certificate&& cert) noexcept
|
X509Certificate& X509Certificate::operator = (X509Certificate&& cert) noexcept
|
||||||
{
|
{
|
||||||
Poco::Crypto::X509Certificate::operator = (cert);
|
Poco::Crypto::X509Certificate::operator = (std::move(cert));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ bool X509Certificate::verify(const std::string& hostName) const
|
|||||||
|
|
||||||
|
|
||||||
bool X509Certificate::verify(const Poco::Crypto::X509Certificate& certificate, const std::string& hostName)
|
bool X509Certificate::verify(const Poco::Crypto::X509Certificate& certificate, const std::string& hostName)
|
||||||
{
|
{
|
||||||
#if OPENSSL_VERSION_NUMBER < 0x10002000L
|
#if OPENSSL_VERSION_NUMBER < 0x10002000L
|
||||||
std::string commonName;
|
std::string commonName;
|
||||||
std::set<std::string> dnsNames;
|
std::set<std::string> dnsNames;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user