privatekey.h

来自「MiniSip Client with DomainKeys Authentic」· C头文件 代码 · 共 68 行

H
68
字号
#ifndef PRIVATEKEY_H_#define PRIVATEKEY_H_#include <libmcrypto/config.h>#include <libmutil/Exception.h>#include <openssl/pem.h>#include <openssl/evp.h>#include <openssl/err.h>#include <libmcrypto/OpenSSLUtil.h>#include <string>#include <iostream>#include <fstream>/** * This class represents a private key (RSA). * The implementation of this class referes to the openssl library. */class LIBMCRYPTO_API PrivateKey{	public:		/**		 * The constructor creates a new private key by opening it from a file.		 * @param file Filename (whole path)		 * @param passwd Password for private key		 */		PrivateKey(std::string file, std::string passwd);		/**		 * Destructor of PrivateKey		 */		~PrivateKey();		/**		 * This method creates a signature for the given data.		 * The signing process is implemented with the openssl functions.		 * @param data byte_t array with the data		 * @param dataLength Length of the data		 * @param signature byte_t array in which the signature is stored		 * @param signatureLength Length of the signature		 * @return boolean value if the signing was successful		 */		bool sign(byte_t* data, unsigned int dataLength, byte_t* signature, unsigned int& signatureLength);				/**		 * Static method to check if a given private key is password protected.		 * @param file Filename (whole path)		 * @return boolean value if the key is protected by password		 */		static bool needsPasswd(std::string file);	private:		/**		 * openssl private key		 */		EVP_PKEY * privateKey;};class LIBMCRYPTO_API PrivateKeyException : public Exception{	public:		/**		 * PrivateKey exception representing an exception withing the private key.		 * @param desc Description of the exception		 */		PrivateKeyException(const char *desc) : Exception(desc) {};};#endif /*PRIVATEKEY_H_*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?