public static bool auth(Shared shared, Users authorizedUsers, PicoBuffer returnedStoredData, QrCallback qrCallback, object data, PicoBuffer localSymmetricKey) { IntPtr sharedPtr = IntPtr.Zero; if (shared != null) { sharedPtr = shared.getIntPtr(); } IntPtr usersPtr = IntPtr.Zero; if (authorizedUsers != null) { usersPtr = authorizedUsers.getIntPtr(); } IntPtr storedDataPtr = IntPtr.Zero; if (returnedStoredData != null) { storedDataPtr = returnedStoredData.getIntPtr(); } IntPtr localSymmetricKeyPtr = IntPtr.Zero; if (localSymmetricKey != null) { localSymmetricKeyPtr = localSymmetricKey.getIntPtr(); } PicoDLL.QrCallbackFunctionInternal internalDelegate = delegate(string qrData, IntPtr intPtr) { return(qrCallback(qrData, ((GCHandle)intPtr).Target)); }; return(PicoDLL.auth(sharedPtr, usersPtr, storedDataPtr, internalDelegate, (IntPtr)GCHandle.Alloc(data), localSymmetricKeyPtr)); }
public string to_string() { // TODO free IntPtr ptr = PicoDLL.buffer_copy_to_new_string(handle); return(Marshal.PtrToStringAnsi(ptr)); }
public int copy_to_array(byte[] str, int max_length = -1) { if (max_length == -1) { max_length = str.Length; } return(PicoDLL.buffer_copy_to_string(handle, str, max_length)); }
public int serialize(byte[] buffer, int size = -1) { if (size == -1) { size = buffer.Length; } return(PicoDLL.json_serialize(handle, buffer, size)); }
public void set(PicoBuffer serviceAddress, string terminalAddress, PicoBuffer terminalCommitment, KeyPair serviceIdentityKey) { IntPtr terminalCommitmentPtr = IntPtr.Zero; if (terminalCommitment != null) { terminalCommitmentPtr = terminalCommitment.getIntPtr(); } PicoDLL.keyauth_set(handle, serviceAddress.getIntPtr(), terminalAddress, terminalCommitmentPtr, serviceIdentityKey.getIntPtr()); }
public void log(bool base64 = false) { if (base64) { PicoDLL.buffer_log_base64(handle); } else { PicoDLL.buffer_log(handle); } }
public void print(bool base64 = false) { if (base64) { PicoDLL.buffer_print_base64(handle); } else { PicoDLL.buffer_print(handle); } }
public static bool pair_loop(Shared shared, string servicename, string extraData, PicoBuffer returnedStoredData, QrCallback qrCallback, object data, int loopVerifier) { IntPtr sharedPtr = IntPtr.Zero; if (shared != null) { sharedPtr = shared.getIntPtr(); } IntPtr storedDataPtr = IntPtr.Zero; if (returnedStoredData != null) { storedDataPtr = returnedStoredData.getIntPtr(); } PicoDLL.QrCallbackFunctionInternal internalDelegate = delegate(string qrData, IntPtr intPtr) { return(qrCallback(qrData, ((GCHandle)intPtr).Target)); }; return(PicoDLL.pair_loop(sharedPtr, servicename, extraData, storedDataPtr, internalDelegate, (IntPtr)GCHandle.Alloc(data), loopVerifier)); }
public static bool verify(Shared shared, Channel channel, Users authorizedUsers, string extraData, PicoBuffer returnedStoredData, PicoBuffer localSymmetricKey) { IntPtr usersPtr = IntPtr.Zero; if (authorizedUsers != null) { usersPtr = authorizedUsers.getIntPtr(); } IntPtr storedDataPtr = IntPtr.Zero; if (returnedStoredData != null) { storedDataPtr = returnedStoredData.getIntPtr(); } IntPtr localSymmetricKeyPtr = IntPtr.Zero; if (localSymmetricKey != null) { localSymmetricKeyPtr = localSymmetricKey.getIntPtr(); } return(PicoDLL.sigmaverifier(shared.getIntPtr(), channel.getIntPtr(), usersPtr, extraData, storedDataPtr, localSymmetricKeyPtr)); }
public void delete() { PicoDLL.channel_delete(handle); }
public static Channel connect(string name) { return(new Channel(PicoDLL.channel_connect(name))); }
public int serialize(byte[] data) { return(PicoDLL.keyauth_serialize(handle, data, data.Length)); }
public Channel() { handle = PicoDLL.channel_new(); }
public void get_url(PicoBuffer buff) { PicoDLL.channel_get_url(handle, buff.getIntPtr()); }
public void print() { PicoDLL.keypairing_print(handle); }
public void sign_data(PicoBuffer bufferin, PicoBuffer bufferout) { PicoDLL.keypair_sign_data(handle, bufferin.getIntPtr(), bufferout.getIntPtr()); }
public bool write_buffer(PicoBuffer buff) { return(PicoDLL.channel_write_buffer(handle, buff.getIntPtr())); }
public KeyAuth() { handle = PicoDLL.keyauth_new(); }
public KeyPairing() { handle = PicoDLL.keypairing_new(); }
public int serialize(byte[] buffer) { return(PicoDLL.keypairing_serialize(handle, buffer, buffer.Length)); }
public int serialize_size() { return(PicoDLL.keypairing_serialize_size(handle)); }
public void log() { PicoDLL.keypairing_log(handle); }
public bool read(PicoBuffer buff) { return(PicoDLL.channel_read(handle, buff.getIntPtr())); }
public void print() { PicoDLL.keyauth_print(handle); }
public bool write(byte[] data, int length) { return(PicoDLL.channel_write(handle, data, length)); }
public void log() { PicoDLL.keyauth_log(handle); }
public string get_name() { IntPtr nameptr = PicoDLL.channel_get_name(handle); return(Marshal.PtrToStringAnsi(nameptr)); }
public int serialize_size() { return(PicoDLL.keyauth_serialize_size(handle)); }
public void delete() { PicoDLL.keyauth_delete(handle); }
public void delete() { PicoDLL.keypairing_delete(handle); }