CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
rsa_encryption_padding.h
1
2#pragma once
3
4#include <system/iequatable.h>
5#include <security/cryptography/rsa_encryption_padding_mode.h>
6#include <security/cryptography/hash_algorithm_name.h>
7
8namespace System { namespace Security { namespace Cryptography {
9
11class ASPOSECPP_SHARED_CLASS RSAEncryptionPadding final
12 : public IEquatable<SharedPtr<RSAEncryptionPadding>>
13{
17 typedef Object BaseType;
19 ASPOSECPP_SHARED_RTTI_INFO_DECL();
20
21public:
23 static ASPOSECPP_SHARED_API SharedPtr<RSAEncryptionPadding> get_Pkcs1();
24
26 static ASPOSECPP_SHARED_API SharedPtr<RSAEncryptionPadding> get_OaepSHA1();
27
29 static ASPOSECPP_SHARED_API SharedPtr<RSAEncryptionPadding> get_OaepSHA256();
30
32 static ASPOSECPP_SHARED_API SharedPtr<RSAEncryptionPadding> get_OaepSHA384();
33
35 static ASPOSECPP_SHARED_API SharedPtr<RSAEncryptionPadding> get_OaepSHA512();
36
38 static ASPOSECPP_SHARED_API SharedPtr<RSAEncryptionPadding> CreateOaep(const HashAlgorithmName& hash_algorithm);
39
42 {
43 return m_mode;
44 }
45
48 {
49 return m_oaep_hash_algorithm;
50 }
51
52 ASPOSECPP_SHARED_API int GetHashCode() const override;
53 ASPOSECPP_SHARED_API bool Equals(SharedPtr<Object> other) override;
54 ASPOSECPP_SHARED_API bool Equals(SharedPtr<RSAEncryptionPadding> other) override;
55 ASPOSECPP_SHARED_API String ToString() const override;
56
57private:
58 const RSAEncryptionPaddingMode m_mode;
59 const HashAlgorithmName m_oaep_hash_algorithm;
60
62 : m_mode(mode)
63 , m_oaep_hash_algorithm(oaep_hash_algorithm)
64 {}
65 MEMBER_FUNCTION_MAKE_OBJECT(RSAEncryptionPadding, CODEPORTING_ARGS(RSAEncryptionPaddingMode mode, const HashAlgorithmName& oaep_hash_algorithm), CODEPORTING_ARGS(mode, oaep_hash_algorithm));
66
67 ASPOSECPP_SHARED_API ~RSAEncryptionPadding();
68};
69
71{
72 if (left.get() == nullptr)
73 return right.get() == nullptr;
74
75 return left->Equals(right);
76}
77
79{
80 return !(left == right);
81}
82
83}}} // namespace System::Security::Cryptography
Defines a method that determines the equality of two objects. Objects of this class should only be al...
Definition: iequatable.h:16
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Padding mode and parameters for RSA encryption or decryption operations.
Definition: rsa_encryption_padding.h:13
static SharedPtr< RSAEncryptionPadding > get_OaepSHA256()
Gets OAEP mode with SHA256 hash algorithm.
static SharedPtr< RSAEncryptionPadding > get_OaepSHA1()
Gets OAEP mode with SHA1 hash algorithm.
static SharedPtr< RSAEncryptionPadding > get_OaepSHA384()
Gets OAEP mode with SHA384 hash algorithm.
int GetHashCode() const override
Analog of C# Object.GetHashCode() method. Enables hashing of custom objects.
static SharedPtr< RSAEncryptionPadding > get_OaepSHA512()
Gets OAEP mode with SHA512 hash algorithm.
bool Equals(SharedPtr< RSAEncryptionPadding > other) override
String ToString() const override
Analog of C# Object.ToString() method. Enables converting custom objects to string.
static SharedPtr< RSAEncryptionPadding > get_Pkcs1()
Gets PKCS #1 v1.5 mode.
const HashAlgorithmName & get_OaepHashAlgorithm() const
Gets the hash algorithm used with OAEP.
Definition: rsa_encryption_padding.h:47
static SharedPtr< RSAEncryptionPadding > CreateOaep(const HashAlgorithmName &hash_algorithm)
Creates RSAEncryptionPadding with OAEP mode and specified hash algorithm.
bool Equals(SharedPtr< Object > other) override
RSAEncryptionPaddingMode get_Mode() const
Gets the padding mode.
Definition: rsa_encryption_padding.h:41
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Pointee_ * get() const
Gets pointed object.
Definition: smart_ptr.h:518
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
constexpr bool operator==(std::nullptr_t, const HashAlgorithmName &)
Definition: hash_algorithm_name.h:124
constexpr bool operator!=(std::nullptr_t, const HashAlgorithmName &)
Definition: hash_algorithm_name.h:125
RSAEncryptionPaddingMode
Padding mode used with RSA encryption or decryption operations.
Definition: rsa_encryption_padding_mode.h:10
Definition: db_command.h:9
String representing the name of a hash algorithm. This type should be allocated on stack and passed t...
Definition: hash_algorithm_name.h:13