|
1 | 1 | using System; |
2 | 2 | using System.Runtime.InteropServices; |
| 3 | +using System.Text; |
3 | 4 |
|
4 | 5 | namespace AuthenticodeLint.Interop |
5 | 6 | { |
@@ -121,6 +122,36 @@ public static unsafe extern bool CryptMsgGetParam |
121 | 122 | [param: In] void* pvData, |
122 | 123 | [param: In, Out, MarshalAs(UnmanagedType.U4)] ref uint pcbData |
123 | 124 | ); |
| 125 | + |
| 126 | + [method: DllImport("crypt32.dll", CallingConvention = CallingConvention.Winapi, EntryPoint = "CryptBinaryToString", SetLastError = true)] |
| 127 | + [return: MarshalAs(UnmanagedType.Bool)] |
| 128 | + public static unsafe extern bool CryptBinaryToString |
| 129 | + ( |
| 130 | + [param: In] byte[] pbBinary, |
| 131 | + [param: In, MarshalAs(UnmanagedType.U4)] uint cbBinary, |
| 132 | + [param: In, MarshalAs(UnmanagedType.U4)] CryptBinaryToStringFlags dwFlags, |
| 133 | + [param: In, Out] StringBuilder pszString, |
| 134 | + [param: In, Out] ref uint pcchString |
| 135 | + ); |
| 136 | + } |
| 137 | + |
| 138 | + internal enum CryptBinaryToStringFlags : uint |
| 139 | + { |
| 140 | + CRYPT_STRING_BASE64HEADER = 0x00000000, |
| 141 | + CRYPT_STRING_BASE64 = 0x00000001, |
| 142 | + CRYPT_STRING_BINARY = 0x00000002, |
| 143 | + CRYPT_STRING_BASE64REQUESTHEADER = 0x00000003, |
| 144 | + CRYPT_STRING_HEX = 0x00000004, |
| 145 | + CRYPT_STRING_HEXASCII = 0x00000005, |
| 146 | + CRYPT_STRING_BASE64X509CRLHEADER = 0x00000009, |
| 147 | + CRYPT_STRING_HEXADDR = 0x0000000a, |
| 148 | + CRYPT_STRING_HEXASCIIADDR = 0x0000000b, |
| 149 | + CRYPT_STRING_HEXRAW = 0x0000000c, |
| 150 | + CRYPT_STRING_STRICT = 0x20000000, |
| 151 | + |
| 152 | + CRYPT_STRING_NOCRLF = 0x40000000, |
| 153 | + CRYPT_STRING_NOCR = 0x80000000, |
| 154 | + |
124 | 155 | } |
125 | 156 |
|
126 | 157 | internal enum CryptQueryObjectType : uint |
|
0 commit comments