Esempio n. 1
0
        public static int Final(global::NitraLibSodium.GenericHash.Blake2bState state, byte[] @out, ulong outlen)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;
            var __ret  = __Internal.Final(__arg0, MarshalHelper.ByteArrayToIntPtr(@out), outlen);

            return(__ret);
        }
Esempio n. 2
0
        public static int OpenDetachedAfternm(byte[] m, byte[] c, byte[] mac, ulong clen, byte[] n, byte[] k)
        {
            var __ret = __Internal.OpenDetachedAfternm(MarshalHelper.ByteArrayToIntPtr(m), MarshalHelper.ByteArrayToIntPtr(c), MarshalHelper.ByteArrayToIntPtr(mac),
                                                       clen, MarshalHelper.ByteArrayToIntPtr(n), MarshalHelper.ByteArrayToIntPtr(k));

            return(__ret);
        }
Esempio n. 3
0
        public static int IetfDecryptDetached(byte[] m, byte[] nsec, byte[] c, ulong clen, byte[] mac, byte[] ad, ulong adlen, byte[] npub, byte[] k)
        {
            var __ret = __Internal.IetfDecryptDetached(MarshalHelper.ByteArrayToIntPtr(m), MarshalHelper.ByteArrayToIntPtr(nsec), MarshalHelper.ByteArrayToIntPtr(c), clen, MarshalHelper.ByteArrayToIntPtr(mac),
                                                       MarshalHelper.ByteArrayToIntPtr(ad), adlen, MarshalHelper.ByteArrayToIntPtr(npub), MarshalHelper.ByteArrayToIntPtr(k));

            return(__ret);
        }
Esempio n. 4
0
        public static int Init(global::NitraLibSodium.OneTimeAuth.Poly1305State state, byte[] key)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;
            var __ret  = __Internal.Init(__arg0, MarshalHelper.ByteArrayToIntPtr(key));

            return(__ret);
        }
Esempio n. 5
0
        public static int FinalVerify(global::NitraLibSodium.Sign.Ed25519phState state, byte[] sig, byte[] pk)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;
            var __ret  = __Internal.FinalVerify(__arg0, MarshalHelper.ByteArrayToIntPtr(sig), MarshalHelper.ByteArrayToIntPtr(pk));

            return(__ret);
        }
Esempio n. 6
0
        public static int InitSaltPersonal(global::NitraLibSodium.GenericHash.Blake2bState state, byte[] key, ulong keylen, ulong outlen, byte[] salt, byte[] personal)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;
            var __ret  = __Internal.InitSaltPersonal(__arg0, MarshalHelper.ByteArrayToIntPtr(key), keylen, outlen, MarshalHelper.ByteArrayToIntPtr(salt), MarshalHelper.ByteArrayToIntPtr(personal));

            return(__ret);
        }
Esempio n. 7
0
        public static int Update(global::NitraLibSodium.Sign.Ed25519phState state, byte[] m, ulong mlen)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;
            var __ret  = __Internal.Update(__arg0, MarshalHelper.ByteArrayToIntPtr(m), mlen);

            return(__ret);
        }
Esempio n. 8
0
        public static int Init(global::NitraLibSodium.Auth.HmacSha256State state, byte[] key, ulong keylen)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;
            var __ret  = __Internal.Init(__arg0, MarshalHelper.ByteArrayToIntPtr(key), keylen);

            return(__ret);
        }
        public static int SealOpen(byte[] m, byte[] c, ulong clen, byte[] pk, byte[] sk)
        {
            var __ret = __Internal.SealOpen(MarshalHelper.ByteArrayToIntPtr(m), MarshalHelper.ByteArrayToIntPtr(c), clen, MarshalHelper.ByteArrayToIntPtr(pk),
                                            MarshalHelper.ByteArrayToIntPtr(sk));

            return(__ret);
        }
        public static int Easy(byte[] c, byte[] m, ulong mlen, byte[] n, byte[] pk, byte[] sk)
        {
            var __ret = __Internal.Easy(MarshalHelper.ByteArrayToIntPtr(c), MarshalHelper.ByteArrayToIntPtr(m), mlen, MarshalHelper.ByteArrayToIntPtr(n),
                                        MarshalHelper.ByteArrayToIntPtr(pk), MarshalHelper.ByteArrayToIntPtr(sk));

            return(__ret);
        }
Esempio n. 11
0
        public static int Update(global::NitraLibSodium.Hash.Sha256State state, byte[] @in, ulong inlen)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;
            var __ret  = __Internal.Update(__arg0, MarshalHelper.ByteArrayToIntPtr(@in), inlen);

            return(__ret);
        }
Esempio n. 12
0
        public static int Final(global::NitraLibSodium.Hash.Sha256State state, byte[] @out)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;
            var __ret  = __Internal.Final(__arg0, MarshalHelper.ByteArrayToIntPtr(@out));

            return(__ret);
        }
Esempio n. 13
0
        public static int BoxCurve25519xsalsa20poly1305(byte[] c, byte[] m, ulong mlen, byte[] n, byte[] pk, byte[] sk)
        {
            var __ret = __Internal.BoxCurve25519xsalsa20poly1305(MarshalHelper.ByteArrayToIntPtr(c), MarshalHelper.ByteArrayToIntPtr(m), mlen,
                                                                 MarshalHelper.ByteArrayToIntPtr(n), MarshalHelper.ByteArrayToIntPtr(pk), MarshalHelper.ByteArrayToIntPtr(sk));

            return(__ret);
        }
Esempio n. 14
0
        public static int Beforenm(byte[] ctx_, byte[] k)
        {
            if (ctx_ == null || ctx_.Length != 512)
            {
                throw new ArgumentOutOfRangeException("ctx_", "The dimensions of the provided array don't match the required size.");
            }
            var __ret = __Internal.Beforenm(ctx_, MarshalHelper.ByteArrayToIntPtr(k));

            return(__ret);
        }
Esempio n. 15
0
        public static int Detached(byte[] sig, ref ulong siglen_p, byte[] m, ulong mlen, byte[] sk)
        {
            fixed(ulong *__refParamPtr1 = &siglen_p)
            {
                var __arg1 = __refParamPtr1;
                var __ret  = __Internal.Detached(MarshalHelper.ByteArrayToIntPtr(sig), __arg1, MarshalHelper.ByteArrayToIntPtr(m), mlen, MarshalHelper.ByteArrayToIntPtr(sk));

                return(__ret);
            }
        }
Esempio n. 16
0
        public static int Open(byte[] m, ref ulong mlen_p, byte[] sm, ulong smlen, byte[] pk)
        {
            fixed(ulong *__refParamPtr1 = &mlen_p)
            {
                var __arg1 = __refParamPtr1;
                var __ret  = __Internal.Open(MarshalHelper.ByteArrayToIntPtr(m), __arg1, MarshalHelper.ByteArrayToIntPtr(sm), smlen, MarshalHelper.ByteArrayToIntPtr(pk));

                return(__ret);
            }
        }
Esempio n. 17
0
        public static int CryptoEd25519(byte[] sm, ref ulong smlen_p, byte[] m, ulong mlen, byte[] sk)
        {
            fixed(ulong *__refParamPtr1 = &smlen_p)
            {
                var __arg1 = __refParamPtr1;
                var __ret  = __Internal.Ed25519(MarshalHelper.ByteArrayToIntPtr(sm), __arg1, MarshalHelper.ByteArrayToIntPtr(m), mlen, MarshalHelper.ByteArrayToIntPtr(sk));

                return(__ret);
            }
        }
Esempio n. 18
0
        public static int IetfEncrypt(byte[] c, ref ulong clen_p, byte[] m, ulong mlen, byte[] ad, ulong adlen, byte[] nsec, byte[] npub, byte[] k)
        {
            fixed(ulong *__refParamPtr1 = &clen_p)
            {
                var __arg1 = __refParamPtr1;
                var __ret  = __Internal.IetfEncrypt(MarshalHelper.ByteArrayToIntPtr(c), __arg1, MarshalHelper.ByteArrayToIntPtr(m), mlen, MarshalHelper.ByteArrayToIntPtr(ad), adlen,
                                                    MarshalHelper.ByteArrayToIntPtr(nsec), MarshalHelper.ByteArrayToIntPtr(npub), MarshalHelper.ByteArrayToIntPtr(k));

                return(__ret);
            }
        }
        public static int EncryptDetached(byte[] c, byte[] mac, ref ulong maclen_p, byte[] m, ulong mlen, byte[] ad, ulong adlen, byte[] nsec, byte[] npub, byte[] k)
        {
            fixed(ulong *__refParamPtr2 = &maclen_p)
            {
                var __arg2 = __refParamPtr2;
                var __ret  = __Internal.EncryptDetached(MarshalHelper.ByteArrayToIntPtr(c), MarshalHelper.ByteArrayToIntPtr(mac), __arg2, MarshalHelper.ByteArrayToIntPtr(m),
                                                        mlen, MarshalHelper.ByteArrayToIntPtr(ad), adlen, MarshalHelper.ByteArrayToIntPtr(nsec), MarshalHelper.ByteArrayToIntPtr(npub), MarshalHelper.ByteArrayToIntPtr(k));

                return(__ret);
            }
        }
Esempio n. 20
0
        public static int DecryptDetachedAfternm(byte[] m, byte[] nsec, byte[] c, ulong clen, byte[] mac, byte[] ad, ulong adlen, byte[] npub, byte[] ctx_)
        {
            if (ctx_ == null || ctx_.Length != 512)
            {
                throw new ArgumentOutOfRangeException("ctx_", "The dimensions of the provided array don't match the required size.");
            }
            var __ret = __Internal.DecryptDetachedAfternm(MarshalHelper.ByteArrayToIntPtr(m), MarshalHelper.ByteArrayToIntPtr(nsec),
                                                          MarshalHelper.ByteArrayToIntPtr(c), clen, MarshalHelper.ByteArrayToIntPtr(mac), MarshalHelper.ByteArrayToIntPtr(ad), adlen,
                                                          MarshalHelper.ByteArrayToIntPtr(npub), ctx_);

            return(__ret);
        }
Esempio n. 21
0
        public static int FinalCreate(global::NitraLibSodium.Sign.Ed25519phState state, byte[] sig, ref ulong siglen_p, byte[] sk)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;

            fixed(ulong *__refParamPtr2 = &siglen_p)
            {
                var __arg2 = __refParamPtr2;
                var __ret  = __Internal.FinalCreate(__arg0, MarshalHelper.ByteArrayToIntPtr(sig), __arg2, MarshalHelper.ByteArrayToIntPtr(sk));

                return(__ret);
            }
        }
        public static int Pull(global::NitraLibSodium.SecretStream.Xchacha20poly1305State state, byte[] m, ref ulong mlen_p, byte[] tag_p, byte[] c, ulong clen, byte[] ad, ulong adlen)
        {
            var __arg0 = ReferenceEquals(state, null) ? global::System.IntPtr.Zero : state.__Instance;

            fixed(ulong *__refParamPtr2 = &mlen_p)
            {
                var __arg2 = __refParamPtr2;
                var __ret  = __Internal.Pull(__arg0, MarshalHelper.ByteArrayToIntPtr(m), __arg2, MarshalHelper.ByteArrayToIntPtr(tag_p), MarshalHelper.ByteArrayToIntPtr(c), clen, MarshalHelper.ByteArrayToIntPtr(ad), adlen);

                return(__ret);
            }
        }
Esempio n. 23
0
        public static int DeriveFromKey(byte[] subkey, ulong subkey_len, ulong subkey_id, sbyte[] ctx, byte[] key)
        {
            if (ctx == null || ctx.Length != 8)
            {
                throw new ArgumentOutOfRangeException("ctx", "The dimensions of the provided array don't match the required size.");
            }
            if (key == null || key.Length != 32)
            {
                throw new ArgumentOutOfRangeException("key", "The dimensions of the provided array don't match the required size.");
            }
            var __ret = __Internal.DeriveFromKey(MarshalHelper.ByteArrayToIntPtr(subkey), subkey_len, subkey_id, ctx, key);

            return(__ret);
        }
Esempio n. 24
0
        public static int EncryptDetachedAfternm(byte[] c, byte[] mac, ref ulong maclen_p, byte[] m, ulong mlen, byte[] ad, ulong adlen, byte[] nsec, byte[] npub, byte[] ctx_)
        {
            fixed(ulong *__refParamPtr2 = &maclen_p)
            {
                var __arg2 = __refParamPtr2;

                if (ctx_ == null || ctx_.Length != 512)
                {
                    throw new ArgumentOutOfRangeException("ctx_", "The dimensions of the provided array don't match the required size.");
                }
                var __ret = __Internal.EncryptDetachedAfternm(MarshalHelper.ByteArrayToIntPtr(c), MarshalHelper.ByteArrayToIntPtr(mac), __arg2, MarshalHelper.ByteArrayToIntPtr(m), mlen,
                                                              MarshalHelper.ByteArrayToIntPtr(ad), adlen, MarshalHelper.ByteArrayToIntPtr(nsec), MarshalHelper.ByteArrayToIntPtr(npub), ctx_);

                return(__ret);
            }
        }
Esempio n. 25
0
        public static int CryptoArgon2i(byte[] @out, ulong outlen, string passwd, ulong passwdlen, byte[] salt, ulong opslimit, ulong memlimit, int alg)
        {
            var __ret = __Internal.Argon2i(MarshalHelper.ByteArrayToIntPtr(@out), outlen, passwd, passwdlen, MarshalHelper.ByteArrayToIntPtr(salt), opslimit, memlimit, alg);

            return(__ret);
        }
Esempio n. 26
0
        public static int CryptoSha256(byte[] @out, byte[] @in, ulong inlen)
        {
            var __ret = __Internal.Sha256(MarshalHelper.ByteArrayToIntPtr(@out), MarshalHelper.ByteArrayToIntPtr(@in), inlen);

            return(__ret);
        }
Esempio n. 27
0
        public static int Verify(byte[] h, byte[] @in, ulong inlen, byte[] k)
        {
            var __ret = __Internal.Verify(MarshalHelper.ByteArrayToIntPtr(h), MarshalHelper.ByteArrayToIntPtr(@in), inlen, MarshalHelper.ByteArrayToIntPtr(k));

            return(__ret);
        }
Esempio n. 28
0
        public static int AuthHmacsha256(byte[] @out, byte[] @in, ulong inlen, byte[] k)
        {
            var __ret = __Internal.AuthHmacsha256(MarshalHelper.ByteArrayToIntPtr(@out), MarshalHelper.ByteArrayToIntPtr(@in), inlen, MarshalHelper.ByteArrayToIntPtr(k));

            return(__ret);
        }
Esempio n. 29
0
        public static int XorIc(byte[] c, byte[] m, ulong mlen, byte[] n, ulong ic, byte[] k)
        {
            var __ret = __Internal.XorIc(MarshalHelper.ByteArrayToIntPtr(c), MarshalHelper.ByteArrayToIntPtr(m), mlen, MarshalHelper.ByteArrayToIntPtr(n), ic, MarshalHelper.ByteArrayToIntPtr(k));

            return(__ret);
        }
Esempio n. 30
0
        public static int CryptoXsalsa20(byte[] c, ulong clen, byte[] n, byte[] k)
        {
            var __ret = __Internal.Xsalsa20(MarshalHelper.ByteArrayToIntPtr(c), clen, MarshalHelper.ByteArrayToIntPtr(n), MarshalHelper.ByteArrayToIntPtr(k));

            return(__ret);
        }