本文整理汇总了C#中KeePassLib.Keys.CompositeKey.GenerateKey32方法的典型用法代码示例。如果您正苦于以下问题:C# CompositeKey.GenerateKey32方法的具体用法?C# CompositeKey.GenerateKey32怎么用?C# CompositeKey.GenerateKey32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeePassLib.Keys.CompositeKey
的用法示例。
在下文中一共展示了CompositeKey.GenerateKey32方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
CompositeKey key = new CompositeKey();
KcpPassword pw = new KcpPassword("12345");
key.AddUserKey(pw);
byte[] pwdata = pw.KeyData.ReadData();
Console.WriteLine("PW data:");
Console.WriteLine(string.Join(",", pwdata.Select(x => "0x" + x.ToString("x"))));
byte[] keydata = key.GenerateKey32(pwdata, 6000).ReadData();
Console.WriteLine("Key data:");
Console.WriteLine(string.Join(",", keydata.Select(x => "0x" + x.ToString("x"))));
PwDatabase db = new PwDatabase();
db.MasterKey = key;
KdbxFile kdbx = new KdbxFile(db);
kdbx.Load(@"..\resources\test.kdbx", KdbxFormat.Default, null);
var groups = db.RootGroup.GetGroups(true);
Console.WriteLine("Group count: " + groups.UCount);
var entries = db.RootGroup.GetEntries(true);
Console.WriteLine("Entry count: " + entries.UCount);
CompositeKey key2 = new CompositeKey();
key2.AddUserKey(pw);
KcpKeyFile keyfile = new KcpKeyFile(@"..\resources\keyfile.key");
key2.AddUserKey(keyfile);
byte[] keyfiledata = keyfile.KeyData.ReadData();
Console.WriteLine("Key file data:");
Console.WriteLine(string.Join(",", keyfiledata.Select(x => "0x" + x.ToString("x"))));
Console.WriteLine("Composite Key data:");
byte[] key2data = key2.GenerateKey32(keyfiledata, 6000).ReadData();
Console.WriteLine(string.Join(",", key2data.Select(x => "0x" + x.ToString("x"))));
}