wolfSSL SSL/TLS library, support up to TLS1.3

Dependents:   CyaSSL-Twitter-OAuth4Tw Example-client-tls-cert TwitterReader TweetTest ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers signature.h Source File

signature.h

Go to the documentation of this file.
00001 /* signature.h
00002  *
00003  * Copyright (C) 2006-2020 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * wolfSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 /*!
00023     \file wolfssl/wolfcrypt/signature.h
00024 */
00025 
00026 
00027 #ifndef WOLF_CRYPT_SIGNATURE_H
00028 #define WOLF_CRYPT_SIGNATURE_H
00029 
00030 #include <wolfssl/wolfcrypt/types.h >
00031 #include <wolfssl/wolfcrypt/hash.h >
00032 #include <wolfssl/wolfcrypt/random.h >
00033 
00034 #ifdef __cplusplus
00035     extern "C" {
00036 #endif
00037 
00038 enum wc_SignatureType {
00039     WC_SIGNATURE_TYPE_NONE = 0,
00040     WC_SIGNATURE_TYPE_ECC = 1,
00041     WC_SIGNATURE_TYPE_RSA = 2,
00042     WC_SIGNATURE_TYPE_RSA_W_ENC = 3, /* Adds DER header via wc_EncodeSignature */
00043 };
00044 
00045 WOLFSSL_API int wc_SignatureGetSize(enum wc_SignatureType sig_type,
00046     const void* key, word32 key_len);
00047 
00048 WOLFSSL_API int wc_SignatureVerifyHash(
00049     enum wc_HashType hash_type, enum wc_SignatureType sig_type,
00050     const byte* hash_data, word32 hash_len,
00051     const byte* sig, word32 sig_len,
00052     const void* key, word32 key_len);
00053 
00054 WOLFSSL_API int wc_SignatureVerify(
00055     enum wc_HashType hash_type, enum wc_SignatureType sig_type,
00056     const byte* data, word32 data_len,
00057     const byte* sig, word32 sig_len,
00058     const void* key, word32 key_len);
00059 
00060 WOLFSSL_API int wc_SignatureGenerateHash(
00061     enum wc_HashType hash_type, enum wc_SignatureType sig_type,
00062     const byte* hash_data, word32 hash_len,
00063     byte* sig, word32 *sig_len,
00064     const void* key, word32 key_len, WC_RNG* rng);
00065 WOLFSSL_API int wc_SignatureGenerateHash_ex(
00066     enum wc_HashType hash_type, enum wc_SignatureType sig_type,
00067     const byte* hash_data, word32 hash_len,
00068     byte* sig, word32 *sig_len,
00069     const void* key, word32 key_len, WC_RNG* rng, int verify);
00070 WOLFSSL_API int wc_SignatureGenerate(
00071     enum wc_HashType hash_type, enum wc_SignatureType sig_type,
00072     const byte* data, word32 data_len,
00073     byte* sig, word32 *sig_len,
00074     const void* key, word32 key_len,
00075     WC_RNG* rng);
00076 WOLFSSL_API int wc_SignatureGenerate_ex(
00077     enum wc_HashType hash_type, enum wc_SignatureType sig_type,
00078     const byte* data, word32 data_len,
00079     byte* sig, word32 *sig_len,
00080     const void* key, word32 key_len,
00081     WC_RNG* rng, int verify);
00082 
00083 #ifdef __cplusplus
00084     } /* extern "C" */
00085 #endif
00086 
00087 #endif /* WOLF_CRYPT_SIGNATURE_H */
00088