Example #1
0
        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));
        }
Example #2
0
        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());
        }
Example #3
0
        public static bool pair(Shared shared, string serviceName, string extraData, PicoBuffer returnedStoredData, QrCallback qrCallback, object data)
        {
            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(sharedPtr, serviceName, extraData, storedDataPtr, internalDelegate, (IntPtr)GCHandle.Alloc(data)));
        }
Example #4
0
 public static bool generate_sha256(PicoBuffer bufferin, PicoBuffer bufferout)
 {
     return(PicoDLL.cryptosupport_generate_sha256(bufferin.getIntPtr(), bufferout.getIntPtr()));
 }
Example #5
0
 public void get_next_key(PicoBuffer keyBytes, int length)
 {
     PicoDLL.sigmakeyderiv_get_next_key(handle, keyBytes.getIntPtr(), length);
 }
Example #6
0
 public bool read(PicoBuffer buff)
 {
     return(PicoDLL.channel_read(handle, buff.getIntPtr()));
 }
Example #7
0
 public void get_url(PicoBuffer buff)
 {
     PicoDLL.channel_get_url(handle, buff.getIntPtr());
 }
Example #8
0
 public void set_buffer(PicoBuffer buff)
 {
     PicoDLL.nonce_set_buffer(handle, buff.getIntPtr());
 }
Example #9
0
 public void sign_data(PicoBuffer bufferin, PicoBuffer bufferout)
 {
     PicoDLL.keypair_sign_data(handle, bufferin.getIntPtr(), bufferout.getIntPtr());
 }
Example #10
0
 public int append_lengthprepend(PicoBuffer buff)
 {
     return(PicoDLL.buffer_append_buffer_lengthprepend(handle, buff.getIntPtr()));
 }
Example #11
0
 public int copy_lengthprepend(int start, PicoBuffer bufferout)
 {
     return(PicoDLL.buffer_copy_lengthprepend(handle, start, bufferout.getIntPtr()));
 }
Example #12
0
 public static bool verify_signature(IntPtr publickey, PicoBuffer bufferin, PicoBuffer sigin)
 {
     return(PicoDLL.cryptosupport_verify_signature(publickey, bufferin.getIntPtr(), sigin.getIntPtr()));
 }
Example #13
0
 public static void generate_iv(PicoBuffer iv)
 {
     PicoDLL.cryptosupport_generate_iv(iv.getIntPtr());
 }
Example #14
0
 public static bool generate_mac(PicoBuffer macKey, PicoBuffer data, PicoBuffer bufferout)
 {
     return(PicoDLL.cryptosupport_generate_mac(macKey.getIntPtr(), data.getIntPtr(), bufferout.getIntPtr()));
 }
Example #15
0
 public static void getpublicder(IntPtr eckey, PicoBuffer buffer)
 {
     PicoDLL.cryptosupport_getpublicder(eckey, buffer.getIntPtr());
 }
Example #16
0
 public bool deserialize(PicoBuffer buff)
 {
     return(PicoDLL.json_deserialize_buffer(handle, buff.getIntPtr()));
 }
Example #17
0
 public int serialize(PicoBuffer buffer)
 {
     return(PicoDLL.json_serialize_buffer(handle, buffer.getIntPtr()));
 }
Example #18
0
 public void add(string key, PicoBuffer value)
 {
     PicoDLL.json_add_buffer(handle, key, value.getIntPtr());
 }
Example #19
0
 public bool equals(PicoBuffer buff)
 {
     return(PicoDLL.buffer_equals(handle, buff.getIntPtr()));
 }
Example #20
0
 public static bool generate_commitment_base64(IntPtr publickey, PicoBuffer commitment)
 {
     return(PicoDLL.cryptosupport_generate_commitment_base64(publickey, commitment.getIntPtr()));
 }
Example #21
0
 public int add_user(string name, IntPtr key, PicoBuffer symmetric_key)
 {
     return(PicoDLL.users_add_user(handle, name, key, symmetric_key.getIntPtr()));
 }
Example #22
0
 public static IntPtr read_buffer_public_key(PicoBuffer keybuffer)
 {
     return(PicoDLL.cryptosupport_read_buffer_public_key(keybuffer.getIntPtr()));
 }
Example #23
0
 public void getpublicder(PicoBuffer buff)
 {
     PicoDLL.keypair_getpublicder(handle, buff.getIntPtr());
 }
Example #24
0
 public static bool encrypt_iv_base64(PicoBuffer key, PicoBuffer bufferin, PicoBuffer encryptedout)
 {
     return(PicoDLL.cryptosupport_encrypt_iv_base64(key.getIntPtr(), bufferin.getIntPtr(), encryptedout.getIntPtr()));
 }
Example #25
0
 public static bool decrypt_iv_base64(PicoBuffer key, PicoBuffer bufferin, PicoBuffer cleartextout)
 {
     return(PicoDLL.cryptosupport_decrypt_iv_base64(key.getIntPtr(), bufferin.getIntPtr(), cleartextout.getIntPtr()));
 }
Example #26
0
 public static bool generate_symmetric_key(PicoBuffer key, int size)
 {
     return(PicoDLL.cryptosupport_generate_symmetric_key(key.getIntPtr(), size));
 }
Example #27
0
 public bool write_buffer(PicoBuffer buff)
 {
     return(PicoDLL.channel_write_buffer(handle, buff.getIntPtr()));
 }
Example #28
0
 public static void generate_secret(IntPtr vEphemPriv, IntPtr pEphemPub, PicoBuffer sharedSecretOut)
 {
     PicoDLL.keyagreement_generate_secret(vEphemPriv, pEphemPub, sharedSecretOut.getIntPtr());
 }
Example #29
0
        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));
        }
Example #30
0
 public void set(PicoBuffer sharedSecret, Nonce picoNonce, Nonce serviceNonce)
 {
     PicoDLL.sigmakeyderiv_set(handle, sharedSecret.getIntPtr(), picoNonce.getIntPtr(), serviceNonce.getIntPtr());
 }