56 {
57 global::Interop.NCrypt.ErrorCode errorCode = global::Interop.NCrypt.NCryptGetProperty(ncryptHandle, propertyName,
null, 0, out var pcbResult,
options);
58 switch (errorCode)
59 {
60 case global::Interop.NCrypt.ErrorCode.NTE_NOT_FOUND:
61 return null;
62 default:
63 throw errorCode.ToCryptographicException();
64 case global::Interop.NCrypt.ErrorCode.ERROR_SUCCESS:
65 {
66 byte[]
array =
new byte[pcbResult];
67 fixed (
byte* pbOutput =
array)
68 {
69 errorCode = global::Interop.NCrypt.NCryptGetProperty(ncryptHandle, propertyName, pbOutput,
array.Length, out pcbResult,
options);
70 }
71 switch (errorCode)
72 {
73 case global::Interop.NCrypt.ErrorCode.NTE_NOT_FOUND:
74 return null;
75 default:
76 throw errorCode.ToCryptographicException();
77 case global::Interop.NCrypt.ErrorCode.ERROR_SUCCESS:
80 }
81 }
82 }
83 }