.NET Core - C# - MacOS | Keychain API

痴心易碎 提交于 2019-12-23 03:14:09

问题


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.


回答1:


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. Thanks in advance!



来源:https://stackoverflow.com/questions/50936376/net-core-c-sharp-macos-keychain-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!