| 1 |
/* |
| 2 |
* Copyright 2022 Nikolay Sivov for CodeWeavers |
| 3 |
* |
| 4 |
* This library is free software; you can redistribute it and/or |
| 5 |
* modify it under the terms of the GNU Lesser General Public |
| 6 |
* License as published by the Free Software Foundation; either |
| 7 |
* version 2.1 of the License, or (at your option) any later version. |
| 8 |
* |
| 9 |
* This library is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 |
* Lesser General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU Lesser General Public |
| 15 |
* License along with this library; if not, write to the Free Software |
| 16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifdef __WIDL__ |
| 20 |
#pragma winrt ns_prefix |
| 21 |
#endif |
| 22 |
|
| 23 |
import "inspectable.idl"; |
| 24 |
import "asyncinfo.idl"; |
| 25 |
import "windowscontracts.idl"; |
| 26 |
import "windows.foundation.idl"; |
| 27 |
import "windows.storage.streams.idl"; |
| 28 |
|
| 29 |
namespace Windows.Security.Cryptography |
| 30 |
{ |
| 31 |
typedef enum BinaryStringEncoding BinaryStringEncoding; |
| 32 |
runtimeclass CryptographicBuffer; |
| 33 |
|
| 34 |
[ |
| 35 |
contract(Windows.Foundation.UniversalApiContract, 1.0) |
| 36 |
] |
| 37 |
enum BinaryStringEncoding |
| 38 |
{ |
| 39 |
Utf8 = 0, |
| 40 |
Utf16LE = 1, |
| 41 |
Utf16BE = 2, |
| 42 |
}; |
| 43 |
|
| 44 |
[ |
| 45 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 46 |
exclusiveto(Windows.Security.Cryptography.CryptographicBuffer), |
| 47 |
uuid(320b7e22-3cb0-4cdf-8663-1d28910065eb) |
| 48 |
] |
| 49 |
interface ICryptographicBufferStatics : IInspectable |
| 50 |
{ |
| 51 |
HRESULT Compare( |
| 52 |
[in] Windows.Storage.Streams.IBuffer *object1, |
| 53 |
[in] Windows.Storage.Streams.IBuffer *object2, |
| 54 |
[out, retval] boolean *is_equal |
| 55 |
); |
| 56 |
HRESULT GenerateRandom( |
| 57 |
[in] UINT32 length, |
| 58 |
[out, retval] Windows.Storage.Streams.IBuffer **buffer |
| 59 |
); |
| 60 |
HRESULT GenerateRandomNumber( |
| 61 |
[out, retval] UINT32 *value |
| 62 |
); |
| 63 |
HRESULT CreateFromByteArray( |
| 64 |
[in] UINT32 value_size, |
| 65 |
[in, size_is(value_size)] BYTE *value, |
| 66 |
[out, retval] Windows.Storage.Streams.IBuffer **buffer |
| 67 |
); |
| 68 |
HRESULT CopyToByteArray( |
| 69 |
[in] Windows.Storage.Streams.IBuffer *buffer, |
| 70 |
[out] UINT32 *value_size, |
| 71 |
[out, size_is(, *value_size)] BYTE **value |
| 72 |
); |
| 73 |
HRESULT DecodeFromHexString( |
| 74 |
[in] HSTRING value, |
| 75 |
[out, retval] Windows.Storage.Streams.IBuffer **buffer |
| 76 |
); |
| 77 |
HRESULT EncodeToHexString( |
| 78 |
[in] Windows.Storage.Streams.IBuffer *buffer, |
| 79 |
[out, retval] HSTRING *value |
| 80 |
); |
| 81 |
HRESULT DecodeFromBase64String( |
| 82 |
[in] HSTRING value, |
| 83 |
[out, retval] Windows.Storage.Streams.IBuffer **buffer |
| 84 |
); |
| 85 |
HRESULT EncodeToBase64String( |
| 86 |
[in] Windows.Storage.Streams.IBuffer *buffer, |
| 87 |
[out, retval] HSTRING *value |
| 88 |
); |
| 89 |
HRESULT ConvertStringToBinary( |
| 90 |
[in] HSTRING value, |
| 91 |
[in] Windows.Security.Cryptography.BinaryStringEncoding encoding, |
| 92 |
[out, retval] Windows.Storage.Streams.IBuffer **buffer |
| 93 |
); |
| 94 |
HRESULT ConvertBinaryToString( |
| 95 |
[in] Windows.Security.Cryptography.BinaryStringEncoding encoding, |
| 96 |
[in] Windows.Storage.Streams.IBuffer *buffer, |
| 97 |
[out, retval] HSTRING *value |
| 98 |
); |
| 99 |
} |
| 100 |
|
| 101 |
[ |
| 102 |
contract(Windows.Foundation.UniversalApiContract, 1.0), |
| 103 |
marshaling_behavior(agile), |
| 104 |
static(Windows.Security.Cryptography.ICryptographicBufferStatics, Windows.Foundation.UniversalApiContract, 1.0), |
| 105 |
threading(both) |
| 106 |
] |
| 107 |
runtimeclass CryptographicBuffer |
| 108 |
{ |
| 109 |
} |
| 110 |
} |