internal static int NCryptGetPropertyInt32(SafeCryptKeyHandle hObject, string propertyName) { byte[] array = new byte[4]; int num; CngNative.ErrorCode errorCode = CngNative.NCryptGetProperty(hObject, propertyName, array, array.Length, out num, 0); if (errorCode != CngNative.ErrorCode.Success) { throw new Win32Exception((int)errorCode); } return(BitConverter.ToInt32(array, 0)); }
internal static string NCryptGetPropertyString(SafeCryptKeyHandle hObject, string propertyName) { int num = 0; CngNative.ErrorCode errorCode = CngNative.NCryptGetProperty(hObject, propertyName, null, 0, out num, 0); if (errorCode != CngNative.ErrorCode.Success) { throw new Win32Exception((int)errorCode); } byte[] array = new byte[num]; errorCode = CngNative.NCryptGetProperty(hObject, propertyName, array, array.Length, out num, 0); if (errorCode != CngNative.ErrorCode.Success) { throw new Win32Exception((int)errorCode); } string arg_4E_0 = Encoding.Unicode.GetString(array, 0, num); char[] trimChars = new char[1]; return(arg_4E_0.Trim(trimChars)); }