// XXX if ever using ecc change this to include that. internal static string getHashfunction(ParameterSet pSet) { if (pSet.Name == "1.3.6.1.4.1.311.75.1.1.0") { return "1.3.14.3.2.26"; // sha-1 } else { return "2.16.840.1.101.3.4.2.1"; //sha-256 } }
public DeviceManager(SmartCardParams smartCardParams, ParameterSet parameterSet, bool useVirtualDevice = true) { this.UseVirtualDevice = useVirtualDevice; this.parameterSet = parameterSet; if (smartCardParams == null) { this.smartCardParam = new SmartCardParams("1234", 1, 0, 1); } else { this.smartCardParam = smartCardParams; } }
private void InitDevice(ParameterSet set) { if (device == null) { if (UseVirtualDevice) { device = new VirtualDevice(set, new BigInteger(1, deviceSecret)); } else { // use a smartcard device = new SmartCardDevice(set.Group, set.Gd, smartCardParam); } Gq = set.Group; HashFunctionOID = SecurityLevelUtils.getHashfunction(set); hash = new HashFunction(HashFunctionOID); Gd = set.Gd; } }
/// <summary> /// Constructs a new VirtualDevice instance. /// </summary> /// <param name="parameterSet">The parameter set.</param> /// <param name="xd">The device private key.</param> /// <param name="preGenWdPrime">The pregenerated w_d prime value (for one presentation)</param> public VirtualDevice(ParameterSet parameterSet, FieldZqElement xd, FieldZqElement preGenWdPrime) : this(parameterSet.Group, parameterSet.Gd, FieldZq.CreateFieldZq(parameterSet.Group.Q), xd, preGenWdPrime) { }
/// <summary> /// Constructs a new VirtualDevice instance. /// </summary> /// <param name="parameterSet">The parameter set.</param> /// <param name="xd">The device private key.</param> public VirtualDevice(ParameterSet parameterSet, FieldZqElement xd) : this(parameterSet, xd, null) { }
/// <summary> /// Constructs a new VirtualDevice instance. /// </summary> /// <param name="parameterSet">The parameter set.</param> public VirtualDevice(ParameterSet parameterSet) : this(parameterSet, null, null) { }