.NET Core - C# - MacOS |钥匙串API [英] .NET Core - C# - MacOS | Keychain API

查看:24
本文介绍了.NET Core - C# - MacOS |钥匙串API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用 C# 在 MacOS 上的钥匙串中设置/获取一些密码.设法添加了 Xamarin.iOS 程序集,但似乎无法更进一步.这就是我所拥有的,

使用系统;使用安全;使用基金会;var query = new SecRecord(SecKind.InternetPassword){服务器 = "bugzilla.novell.com",帐户 = "米格尔"};

但是得到一个例外,这不是很有用.我不确定什么值为空.上面的示例直接来自

有人可以帮忙吗?非常感谢任何帮助!

我也尝试在没有枚举的情况下实例化,但仍然出现相同的错误.

解决方案

能够通过调用 security cmd 来解决这个问题 - https://ss64.com/osx/security.html

但如果有人知道如何通过 API 和使用 C# 完成此操作,请告诉我.

Trying to set/get some passwords into Keychain on MacOS, using C#. Managed to add Xamarin.iOS assembly, but can't seem to go further. This is what I have,

using System;
using Security;
using Foundation;

var query = new SecRecord(SecKind.InternetPassword)
{
    Server = "bugzilla.novell.com",
    Account = "miguel"
};

But get an exception, which isn't that useful. I am not sure what value is null. This above example is straight from Xamarin website, but doesn't work. New to this Keychain business, so not sure what I am missing.

Can someone help, please? Any help is greatly appreciated!

I have also tried to instantiate without the enum, but still get the same error.

解决方案

Was able to solve this by calling security cmd - https://ss64.com/osx/security.html

But if anyone knows how this can be done via API and using C#, please let me know.

这篇关于.NET Core - C# - MacOS |钥匙串API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆