diff options
Diffstat (limited to 'io.h')
| -rw-r--r-- | io.h | 79 |
1 files changed, 79 insertions, 0 deletions
@@ -0,0 +1,79 @@ +/* + This file is part of msr. + + msr is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + msr 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 General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with Foobar. If not, see <http://www.gnu.org/licenses/>. +*/ + +#pragma once + +#include <string.h> +#include <termios.h> +#include <unistd.h> + +#include <sys/mman.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include <time.h> + +#include <sodium.h> + +#include "utils.h" +#include "base64.h" +#include "crypto.h" + +#define DEFAULT_COMMENT_PREFIX "untrusted comment: " +#define DEFAULT_COMMENT_TEXT "signature generated by msr" + +#define DEFAULT_TCOMMENT_PREFIX "trusted comment: " +#define DEFAULT_TCOMMENT_FORMAT "timestamp=%lu, file=%s" + +#define DEFAULT_PUBKEY_PREFIX "public key " +#define DEFAULT_SECKEY_PREFIX "encrypted secret key generated by msr" + +#define DEFAULT_SIG_DELIM "--- BEGIN SIGNATURE ---" + +#define MAX_PASS_LEN 1024 +#define MAX_COMMENT_LEN 512 +#define MAX_FILENAME_LEN 1024 + +static char verbose = 1; + + +Error unlock_seckey(const char * const passwdfn, SecretKey sk); + +Error generate_to_file(const char * fn, + const char * const passwdfn, + const char * const pkcomment, + const char * const skcomment); + +Error read_pubkey_string(const char * const str, PublicKey *pk); +Error read_seckey_string(const char * const str, SecretKey *sk); + +Error read_pubkey_file(const char * const fn, + PublicKey *pk); +Error read_seckey_file(const char * const fn, + SecretKey *sk); + +Error sign_attached(const char * const fn, + const char * const passwdfn, SecretKey sk); + +Error sign_detached(const char * const fn, const char * const sfn, + const char * const comment, const char * const trusted_comment, + const char * const passwdfn, SecretKey sk); + +Error verify_attached(const char * const fn, PublicKey pk); + +Error verify_detached(const char * const fn, const char * const sfn, + PublicKey pk); |
