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