CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
ec_dsa.h
1
2#pragma once
3
4#include <security/cryptography/asymmetric_algorithm.h>
5#include <security/cryptography/hash_algorithm_name.h>
6#include <security/cryptography/ec_curve.h>
7#include <security/cryptography/ec_parameters.h>
8
9namespace System { namespace Security { namespace Cryptography {
10
15class ASPOSECPP_SHARED_CLASS ABSTRACT ECDsa : public AsymmetricAlgorithm
16{
18 typedef ECDsa ThisType;
22 ASPOSECPP_SHARED_RTTI_INFO_DECL();
23
24public:
27 ASPOSECPP_SHARED_API String get_KeyExchangeAlgorithm() override;
28
31 ASPOSECPP_SHARED_API String get_SignatureAlgorithm() override;
32
36 virtual ASPOSECPP_SHARED_API ECParameters ExportExplicitParameters(bool include_private_parameters);
37
41 virtual ASPOSECPP_SHARED_API ECParameters ExportParameters(bool include_private_parameters);
42
45 virtual ASPOSECPP_SHARED_API void GenerateKey(const ECCurve& curve);
46
49 virtual ASPOSECPP_SHARED_API void ImportParameters(const ECParameters& parameters);
50
55 virtual ASPOSECPP_SHARED_API ByteArrayPtr SignData(const ByteArrayPtr& data, const HashAlgorithmName& hash_algorithm);
56
63 virtual ASPOSECPP_SHARED_API ByteArrayPtr SignData(const ByteArrayPtr& data, int32_t offset, int32_t count,
64 const HashAlgorithmName& hash_algorithm);
65
70 virtual ASPOSECPP_SHARED_API ByteArrayPtr SignData(const StreamPtr& stream, const HashAlgorithmName& hash_algorithm);
71
75 virtual ASPOSECPP_SHARED_API ByteArrayPtr SignHash(const ByteArrayPtr& hash) = 0;
76
82 ASPOSECPP_SHARED_API bool VerifyData(const ByteArrayPtr& data, const ByteArrayPtr& signature, const HashAlgorithmName& hash_algorithm);
83
91 ASPOSECPP_SHARED_API bool VerifyData(const ByteArrayPtr& data, int32_t offset, int32_t count,
92 const ByteArrayPtr& signature, const HashAlgorithmName& hash_algorithm);
93
99 ASPOSECPP_SHARED_API bool VerifyData(const StreamPtr& stream, const ByteArrayPtr& signature, const HashAlgorithmName& hash_algorithm);
100
105 virtual ASPOSECPP_SHARED_API bool VerifyHash(ByteArrayPtr hash, ByteArrayPtr signature) = 0;
106
109 static ASPOSECPP_SHARED_API SharedPtr<ECDsa> Create();
110
114 static ASPOSECPP_SHARED_API SharedPtr<ECDsa> Create(const ECCurve& curve);
115
119 static ASPOSECPP_SHARED_API SharedPtr<ECDsa> Create(const ECParameters& parameters);
120
124 static ASPOSECPP_SHARED_API SharedPtr<ECDsa> Create(const String& algorithm);
125
126protected:
127 ASPOSECPP_SHARED_API ECDsa();
128
135 virtual ASPOSECPP_SHARED_API ByteArrayPtr HashData(ByteArrayPtr data, int32_t offset, int32_t count, HashAlgorithmName hash_algorithm);
136
141 virtual ASPOSECPP_SHARED_API ByteArrayPtr HashData(StreamPtr stream, HashAlgorithmName hash_algorithm);
142};
143
144}}} // namespace System::Security::Cryptography
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Abstract base class for asymmetric encryption algorithms. Objects of this class should only be alloca...
Definition: asymmetric_algorithm.h:19
Base class for implementations of ECDsa algorithm. Objects of this class should only be allocated usi...
Definition: ec_dsa.h:16
String get_SignatureAlgorithm() override
Gets signature algorithm to use.
static SharedPtr< ECDsa > Create(const ECCurve &curve)
Creates default ECDSA aglorithm implementation with newly created key over the specified curve.
bool VerifyData(const ByteArrayPtr &data, const ByteArrayPtr &signature, const HashAlgorithmName &hash_algorithm)
Verifies that the signature of the specified data is valid.
virtual void ImportParameters(const ECParameters &parameters)
Imports all parameters from data structure.
bool VerifyData(const ByteArrayPtr &data, int32_t offset, int32_t count, const ByteArrayPtr &signature, const HashAlgorithmName &hash_algorithm)
Verifies that the signature of the specified data is valid.
bool VerifyData(const StreamPtr &stream, const ByteArrayPtr &signature, const HashAlgorithmName &hash_algorithm)
Verifies that the signature of the specified binary stream is valid.
static SharedPtr< ECDsa > Create(const ECParameters &parameters)
Creates default ECDSA aglorithm implementation using the specified parameters.
virtual ECParameters ExportExplicitParameters(bool include_private_parameters)
Exports explicit parameters.
virtual ECParameters ExportParameters(bool include_private_parameters)
Exports named or explicit parameters.
virtual ByteArrayPtr HashData(ByteArrayPtr data, int32_t offset, int32_t count, HashAlgorithmName hash_algorithm)
Computes the hash value of the specified data array using the specified hash algorithm.
virtual bool VerifyHash(ByteArrayPtr hash, ByteArrayPtr signature)=0
Checks data signature.
virtual void GenerateKey(const ECCurve &curve)
Generates a new public/private key pair for the specified curve.
virtual ByteArrayPtr SignData(const StreamPtr &stream, const HashAlgorithmName &hash_algorithm)
Computes the hash value of the specified binary stream using the specified hash algorithm,...
virtual ByteArrayPtr HashData(StreamPtr stream, HashAlgorithmName hash_algorithm)
Computes the hash value of the specified binary stream using the specified hash algorithm.
virtual ByteArrayPtr SignData(const ByteArrayPtr &data, const HashAlgorithmName &hash_algorithm)
Computes the hash value of the specified data array using the specified hash algorithm,...
static SharedPtr< ECDsa > Create()
Creates default ECDSA aglorithm implementation.
virtual ByteArrayPtr SignHash(const ByteArrayPtr &hash)=0
Computes the signature of specified input value.
String get_KeyExchangeAlgorithm() override
Gets key exchange algorithm to use.
static SharedPtr< ECDsa > Create(const String &algorithm)
Creates specified ECDSA aglorithm implementation.
virtual ByteArrayPtr SignData(const ByteArrayPtr &data, int32_t offset, int32_t count, const HashAlgorithmName &hash_algorithm)
Computes the hash value of the specified data array using the specified hash algorithm,...
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
Definition: db_command.h:9
An elliptic curve.
Definition: ec_curve.h:13
Public and private key parameters of an elliptic curve.
Definition: ec_parameters.h:11
String representing the name of a hash algorithm. This type should be allocated on stack and passed t...
Definition: hash_algorithm_name.h:13