.NET Core-C#-MacOS |中文钥匙串API [英] .NET Core - C# - MacOS | Keychain API
问题描述
尝试使用C#在MacOS上的Keychain中设置/获取一些密码.设法添加Xamarin.iOS程序集,但似乎无法走得更远.这就是我所拥有的,
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"
};
但是请获取一个例外,它不是那么有用.我不确定什么值是空的.上面的示例直接来自 Xamarin网站,但无效.此钥匙串业务的新手,所以不确定我缺少什么.
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.
推荐答案
能够通过调用security
cmd解决此问题- https://ss64.com/osx/security.html
Was able to solve this by calling security
cmd - https://ss64.com/osx/security.html
但是,如果有人知道如何通过API和使用C#来完成此操作,请告诉我.
But if anyone knows how this can be done via API and using C#, please let me know.
这篇关于.NET Core-C#-MacOS |中文钥匙串API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!