コード例 #1
0
        internal static unsafe int crypto_aead_norx3241_decrypt(
            ref byte m,
            out ulong mlen,
            IntPtr nsec,
            ref byte c,
            ulong clen,
            ref byte ad,
            ulong adlen,
            ref byte npub,
            SecureMemoryHandle k)
        {
            fixed(byte *_m = &m)
            fixed(byte *_c    = &c)
            fixed(byte *_ad   = &ad)
            fixed(byte *_npub = &npub)
            {
                ulong outlen = 0;
                int   result = norx_aead_decrypt(_m, &outlen, _ad, adlen, _c, clen, null, 0, _npub, (byte *)k.DangerousGetHandle());

                mlen = outlen;
                return(result);
            }
        }
コード例 #2
0
ファイル: Norx6441.cs プロジェクト: dustinsoftware/nsec
        internal static unsafe int crypto_aead_norx6441_encrypt(
            ref byte c,
            out ulong clen,
            ref byte m,
            ulong mlen,
            ref byte ad,
            ulong adlen,
            IntPtr nsec,
            ref byte npub,
            SecureMemoryHandle k)
        {
            fixed(byte *_c = &c)
            fixed(byte *_m    = &m)
            fixed(byte *_ad   = &ad)
            fixed(byte *_npub = &npub)
            {
                ulong outlen = 0;

                norx_aead_encrypt(_c, &outlen, _ad, adlen, _m, mlen, null, 0, _npub, (byte *)k.DangerousGetHandle());
                clen = outlen;
                return(0);
            }
        }