// corresponds to the BCRYPT_INIT_AUTH_MODE_INFO macro in bcrypt.h
 public static void Init(out BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO info)
 {
     const uint BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION = 1;
     info = new BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
     {
         cbSize = (uint)sizeof(BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO),
         dwInfoVersion = BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION
     };
 }
Пример #2
0
        // corresponds to the BCRYPT_INIT_AUTH_MODE_INFO macro in bcrypt.h
        public static void Init(out BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO info)
        {
            const uint BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION = 1;

            info = new BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
            {
                cbSize        = (uint)sizeof(BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO),
                dwInfoVersion = BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION
            };
        }
        public void Init_SetsProperties()
        {
            // Arrange
            BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO cipherModeInfo;

            // Act
            BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO.Init(out cipherModeInfo);

            // Assert
            Assert.Equal((uint)sizeof(BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO), cipherModeInfo.cbSize);
            Assert.Equal(1U, cipherModeInfo.dwInfoVersion);
            Assert.Equal(IntPtr.Zero, (IntPtr)cipherModeInfo.pbNonce);
            Assert.Equal(0U, cipherModeInfo.cbNonce);
            Assert.Equal(IntPtr.Zero, (IntPtr)cipherModeInfo.pbAuthData);
            Assert.Equal(0U, cipherModeInfo.cbAuthData);
            Assert.Equal(IntPtr.Zero, (IntPtr)cipherModeInfo.pbTag);
            Assert.Equal(0U, cipherModeInfo.cbTag);
            Assert.Equal(IntPtr.Zero, (IntPtr)cipherModeInfo.pbMacContext);
            Assert.Equal(0U, cipherModeInfo.cbMacContext);
            Assert.Equal(0U, cipherModeInfo.cbAAD);
            Assert.Equal(0UL, cipherModeInfo.cbData);
            Assert.Equal(0U, cipherModeInfo.dwFlags);
        }