private static void GetKey(IntPtr handle, IntPtr keyMetadata, out AesKey key, out string exception) { exception = null; try { var obj = (DecryptionKeyRetriever)GCHandle.FromIntPtr(handle).Target; var keyMetadataStr = Marshal.PtrToStringAnsi(keyMetadata); key = new AesKey(obj.GetKey(keyMetadataStr)); } catch (Exception ex) { key = default; exception = ex.ToString(); } }
private static extern IntPtr FileDecryptionProperties_Footer_Key(IntPtr properties, out AesKey footerKey);
private static extern IntPtr FileDecryptionProperties_Column_Key(IntPtr properties, string columnPath, out AesKey columnKey);
private static extern IntPtr FileDecryptionProperties_Column_Key(IntPtr properties, [MarshalAs(UnmanagedType.LPUTF8Str)] string columnPath, out AesKey columnKey);
private static extern IntPtr ColumnEncryptionProperties_Key(IntPtr properties, out AesKey key);