-
Notifications
You must be signed in to change notification settings - Fork 0
/
Setting.cs
48 lines (42 loc) · 1.19 KB
/
Setting.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using Net.Pkcs11Interop.Common;
using Net.Pkcs11Interop.HighLevelAPI;
namespace SCCrypto
{
public class Settings
{
private string pkcs11LibraryPath;
private Pkcs11 pkcs11Store;
public Mechanism encryptionMechanism
{
internal set;
get;
}
public IUserIO userIO
{
internal set;
get;
}
public Settings(string pkcs11LibraryPath, IUserIO userIO)
{
this.pkcs11LibraryPath = pkcs11LibraryPath;
encryptionMechanism = new Mechanism(CKM.CKM_RSA_PKCS);
this.userIO = userIO;
}
public Settings(string pkcs11LibraryPath, Mechanism encryptionMechanism, IUserIO userIO)
{
this.pkcs11LibraryPath = pkcs11LibraryPath;
this.encryptionMechanism = encryptionMechanism;
this.userIO = userIO;
}
public Pkcs11 GetLibrary()
{
if (pkcs11Store != null)
{
pkcs11Store.Dispose();
}
pkcs11Store = new Pkcs11(pkcs11LibraryPath, AppType.SingleThreaded);
return pkcs11Store;
}
}
}