CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
dsa.h
1
2#pragma once
3
4#include <security/cryptography/asymmetric_algorithm.h>
5#include <security/cryptography/dsa_parameters.h>
6#include <security/cryptography/hash_algorithm_name.h>
7
8namespace System { namespace Security { namespace Cryptography {
9
14class ASPOSECPP_SHARED_CLASS ABSTRACT DSA : public AsymmetricAlgorithm
15{
17 typedef DSA ThisType;
21 ASPOSECPP_SHARED_RTTI_INFO_DECL();
22
23public:
27 virtual ASPOSECPP_SHARED_API ByteArrayPtr CreateSignature(ByteArrayPtr rgb_hash) = 0;
28
33 virtual ASPOSECPP_SHARED_API bool VerifySignature(ByteArrayPtr rgb_hash, ByteArrayPtr rgb_signature) = 0;
34
38 virtual ASPOSECPP_SHARED_API DSAParameters ExportParameters(bool include_private_parameters) = 0;
39
42 virtual ASPOSECPP_SHARED_API void ImportParameters(DSAParameters parameters) = 0;
43
46 virtual ASPOSECPP_SHARED_API void FromXmlString(String xml_string) override;
47
51 virtual ASPOSECPP_SHARED_API String ToXmlString(bool include_private_parameters) override;
52
57 ASPOSECPP_SHARED_API ByteArrayPtr SignData(const ByteArrayPtr& data, const HashAlgorithmName& hash_algorithm);
58
65 ASPOSECPP_SHARED_API ByteArrayPtr SignData(const ByteArrayPtr& data, int32_t offset, int32_t count,
66 const HashAlgorithmName& hash_algorithm);
67
72 ASPOSECPP_SHARED_API ByteArrayPtr SignData(const StreamPtr& stream, const HashAlgorithmName& hash_algorithm);
73
79 ASPOSECPP_SHARED_API bool VerifyData(const ByteArrayPtr& data, const ByteArrayPtr& signature, const HashAlgorithmName& hash_algorithm);
80
88 ASPOSECPP_SHARED_API bool VerifyData(const ByteArrayPtr& data, int32_t offset, int32_t count,
89 const ByteArrayPtr& signature, const HashAlgorithmName& hash_algorithm);
90
96 ASPOSECPP_SHARED_API bool VerifyData(const StreamPtr& stream, const ByteArrayPtr& signature, const HashAlgorithmName& hash_algorithm);
97
100 static ASPOSECPP_SHARED_API SharedPtr<DSA> Create();
101
105 static ASPOSECPP_SHARED_API SharedPtr<DSA> Create(const String& alg_name);
106
109 static ASPOSECPP_SHARED_API SharedPtr<DSA> Create(int32_t key_size_in_bits);
110
113 static ASPOSECPP_SHARED_API SharedPtr<DSA> Create(const DSAParameters& parameters);
114
117 static ASPOSECPP_SHARED_API SharedPtr<DSA> CreateFromXmlString(const String& xml_string);
118
119protected:
120 ASPOSECPP_SHARED_API DSA();
121 ASPOSECPP_SHARED_API ~DSA();
122
129 virtual ASPOSECPP_SHARED_API ByteArrayPtr HashData(ByteArrayPtr data, int32_t offset, int32_t count, HashAlgorithmName hash_algorithm);
130
135 virtual ASPOSECPP_SHARED_API ByteArrayPtr HashData(StreamPtr stream, HashAlgorithmName hash_algorithm);
136};
137
138}}} // 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 DSA algorithm. Objects of this class should only be allocated using...
Definition: dsa.h:15
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,...
static SharedPtr< DSA > Create(const DSAParameters &parameters)
Creates default DSA algorithm implementation with specifed parameters.
virtual DSAParameters ExportParameters(bool include_private_parameters)=0
Exports all parameters.
static SharedPtr< DSA > Create()
Creates default DSA aglorithm implementation.
virtual ByteArrayPtr CreateSignature(ByteArrayPtr rgb_hash)=0
Create DSA signature for the specified data.
virtual void FromXmlString(String xml_string) override
Initializes object using XML-encoded parameters.
static SharedPtr< DSA > CreateFromXmlString(const String &xml_string)
Creates default DSA algorithm implementation with specifed XML-encoded parameters.
static SharedPtr< DSA > Create(int32_t key_size_in_bits)
Creates default DSA algorithm implementation with specifed key size.
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.
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.
ByteArrayPtr SignData(const StreamPtr &stream, const HashAlgorithmName &hash_algorithm)
Computes the hash value of the specified binary stream using the specified hash algorithm,...
virtual bool VerifySignature(ByteArrayPtr rgb_hash, ByteArrayPtr rgb_signature)=0
Verify DSA signature for the specified data.
ByteArrayPtr SignData(const ByteArrayPtr &data, const HashAlgorithmName &hash_algorithm)
Computes the hash value of the specified data array using the specified hash algorithm,...
virtual String ToXmlString(bool include_private_parameters) override
Exports all parameters in XML format.
virtual ByteArrayPtr HashData(StreamPtr stream, HashAlgorithmName hash_algorithm)
Computes the hash value of the specified binary stream using the specified hash algorithm.
virtual void ImportParameters(DSAParameters parameters)=0
Imports all parameters from data structure.
bool VerifyData(const ByteArrayPtr &data, const ByteArrayPtr &signature, const HashAlgorithmName &hash_algorithm)
Verifies that the signature of the specified data is valid.
static SharedPtr< DSA > Create(const String &alg_name)
Creates default DSA algorithm implementation.
bool VerifyData(const StreamPtr &stream, const ByteArrayPtr &signature, const HashAlgorithmName &hash_algorithm)
Verifies that the signature of the specified binary stream is valid.
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
Data structure of DSA algorithm parameters. This type should be allocated on stack and passed to func...
Definition: dsa_parameters.h:13
String representing the name of a hash algorithm. This type should be allocated on stack and passed t...
Definition: hash_algorithm_name.h:13