1
0
mirror of https://github.com/biergaizi/codecrypt synced 2024-06-26 00:38:16 +00:00
codecrypt/src/message.h

65 lines
1.6 KiB
C
Raw Normal View History

2012-09-30 09:55:23 +00:00
2012-11-05 21:45:35 +00:00
/*
* This file is part of Codecrypt.
*
2016-04-17 13:47:47 +00:00
* Copyright (C) 2013-2016 Mirek Kratochvil <exa.exa@gmail.com>
*
2012-11-05 21:45:35 +00:00
* Codecrypt is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Codecrypt is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Codecrypt. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _ccr_msg_h_
#define _ccr_msg_h_
2012-12-02 11:50:29 +00:00
2013-01-04 11:43:36 +00:00
#include <string>
#include "bvector.h"
#include "sencode.h"
2013-01-07 21:29:29 +00:00
#include "algorithm.h"
2013-01-04 11:43:36 +00:00
#include "keyring.h"
#include "prng.h"
class encrypted_msg
{
public:
2013-01-07 23:13:19 +00:00
bvector ciphertext;
2013-01-04 11:43:36 +00:00
std::string alg_id, key_id;
2013-01-07 21:29:29 +00:00
int decrypt (bvector&, algorithm_suite&, keyring&);
2013-01-04 11:43:36 +00:00
int encrypt (const bvector& msg,
const std::string& alg_id,
const std::string& key_id,
2013-01-07 21:29:29 +00:00
algorithm_suite&, keyring&, prng&);
2013-01-04 11:43:36 +00:00
sencode* serialize();
bool unserialize (sencode*);
};
class signed_msg
{
public:
bvector message, signature;
std::string alg_id, key_id;
2013-01-07 21:29:29 +00:00
int verify (algorithm_suite&, keyring&);
2013-01-04 11:43:36 +00:00
int sign (const bvector&msg,
const std::string&alg_id,
const std::string&key_id,
2013-01-07 21:29:29 +00:00
algorithm_suite&, keyring&, prng&);
2013-01-04 11:43:36 +00:00
sencode* serialize();
bool unserialize (sencode*);
};
2012-09-30 09:55:23 +00:00
#endif