semf
signaturepkcs1.h
Go to the documentation of this file.
1
10#ifndef SEMF_APP_PROCESSING_SIGNATUREPKCS1_H_
11#define SEMF_APP_PROCESSING_SIGNATUREPKCS1_H_
12
13#include <stdio.h>
14#include <cstdint>
15#include <cstring>
16
17namespace semf
18{
19namespace app
20{
27{
28public:
30 enum State : bool
31 {
32 Ok = true,
33 Error = false,
34 };
37 {
39 Md5
40 };
41
42 virtual ~SignaturePkcs1() = default;
43
55 virtual State setPublicKey(const uint8_t n[], size_t nLen, const uint8_t e[], size_t eLen) = 0;
66 virtual State setPrivateKey(const uint8_t n[], size_t nLen, const uint8_t d[], size_t dLen) = 0;
75 virtual State sign(const uint8_t hashDigest[], size_t hashBitLen, uint8_t sign[], HashAlgorithm hashAlgorithm) = 0;
85 virtual State verify(const uint8_t hashDigest[], size_t hashBitLen, const uint8_t sign[], HashAlgorithm hashAlgorithm) = 0;
86};
87} /* namespace app */
88} /* namespace semf */
89#endif // SEMF_APP_PROCESSING_SIGNATUREPKCS1_H_
Class for representing errors. Every error should have a unique source code. As a user feel encourage...
Definition: error.h:22
Class for using PKCS1 (Public-Key Cryptography Standards Version 1) asymmetric encryption/decryption ...
virtual State sign(const uint8_t hashDigest[], size_t hashBitLen, uint8_t sign[], HashAlgorithm hashAlgorithm)=0
The function executes a hash algorithm on the given data, and signs the hash-digest using the private...
virtual State verify(const uint8_t hashDigest[], size_t hashBitLen, const uint8_t sign[], HashAlgorithm hashAlgorithm)=0
The function executes a verification of the data data with the given signature sign.
virtual State setPublicKey(const uint8_t n[], size_t nLen, const uint8_t e[], size_t eLen)=0
Pass the modulus N and public key E to the class.
virtual ~SignaturePkcs1()=default
virtual State setPrivateKey(const uint8_t n[], size_t nLen, const uint8_t d[], size_t dLen)=0
Pass the modulus N and private key D to the class.