void IInternalKmsCredentials.SetCredentials(MongoCryptSafeHandle handle, Status status) { unsafe { fixed(byte *p = Key) { IntPtr ptr = (IntPtr)p; using (PinnedBinary pinned = new PinnedBinary(ptr, (uint)Key.Length)) { handle.Check(status, Library.mongocrypt_setopt_kms_provider_local(handle, pinned.Handle)); } } } }