Exemplo n.º 1
0
 /// <summary>
 /// SessionParams constructor
 /// </summary>
 /// 
 /// <param name="EngineType">The Cryptographic <see cref="VTDev.Libraries.CEXEngine.Crypto.Enumeration.BlockCiphers">Engine</see> type</param>
 /// <param name="KeySize">The cipher Key Size in bytes</param>
 /// <param name="IvSize">Size of the cipher <see cref="VTDev.Libraries.CEXEngine.Crypto.Enumeration.IVSizes">Initialization Vector</see></param>
 /// <param name="RoundCount">The number of diffusion <see cref="VTDev.Libraries.CEXEngine.Crypto.Enumeration.RoundCounts">Rounds</see></param>
 /// <param name="KdfEngine">The <see cref="VTDev.Libraries.CEXEngine.Crypto.Enumeration.Digests">Digest</see> engine used to power the key schedule Key Derivation Function in HX and M series ciphers</param>
 /// 
 /// <exception cref="System.ArgumentOutOfRangeException">Thrown if an invalid KeyId, MessageKey, or ExtensionKey is used</exception>
 public DtmSession(BlockCiphers EngineType = BlockCiphers.RDX, int KeySize = 32, IVSizes IvSize = IVSizes.V128, RoundCounts RoundCount = RoundCounts.R14, Digests KdfEngine = Digests.SHA512)
 {
     this.EngineType = (byte)EngineType;
     this.KeySize = (short)KeySize;
     this.IvSize = (byte)IvSize;
     this.RoundCount = (byte)RoundCount;
     this.KdfEngine = (byte)KdfEngine;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create a volume key file using a manual description of the cipher parameters.
        /// </summary>
        /// 
        /// <param name="KeyCount">The number of key sets associated with this volume key</param>
        /// <param name="EngineType">The Cryptographic <see cref="SymmetricEngines">Engine</see> type</param>
        /// <param name="KeySize">The cipher Key Size in bytes</param>
        /// <param name="IvSize">Size of the cipher <see cref="IVSizes">Initialization Vector</see></param>
        /// <param name="CipherType">The type of <see cref="CipherModes">Cipher Mode</see></param>
        /// <param name="PaddingType">The type of cipher <see cref="PaddingModes">Padding Mode</see></param>
        /// <param name="BlockSize">The cipher <see cref="BlockSizes">Block Size</see></param>
        /// <param name="Rounds">The number of diffusion <see cref="RoundCounts">Rounds</see></param>
        /// <param name="KdfEngine">The <see cref="Digests">Digest</see> engine used to power the key schedule Key Derivation Function in HX and M series ciphers</param>
        /// <param name="MacSize">The size of the HMAC message authentication code; a zeroed parameter means authentication is not enabled with this key</param>
        /// <param name="MacEngine">The HMAC <see cref="Digests">Digest</see> engine used to authenticate a message file encrypted with this key</param>
        /// 
        /// <exception cref="System.IO.FileLoadException">A key file exists at the path specified</exception>
        /// <exception cref="System.UnauthorizedAccessException">The key file path is read only</exception>
        public void Create(int KeyCount, SymmetricEngines EngineType, int KeySize, IVSizes IvSize, CipherModes CipherType,
            PaddingModes PaddingType, BlockSizes BlockSize, RoundCounts Rounds, Digests KdfEngine, int MacSize, Digests MacEngine)
        {
            CipherDescription dsc = new CipherDescription()
            {
                EngineType = (int)EngineType,
                KeySize = KeySize,
                IvSize = (int)IvSize,
                CipherType = (int)CipherType,
                PaddingType = (int)PaddingType,
                BlockSize = (int)BlockSize,
                RoundCount = (int)Rounds,
                KdfEngine = (int)KdfEngine,
                MacEngine = (int)MacEngine,
                MacSize = MacSize
            };

            Create(dsc, KeyCount);
        }
Exemplo n.º 3
0
 private void OnRoundsCountChanged(object sender, EventArgs e)
 {
     RoundCounts rcount = RoundCounts.R10;
     Enum.TryParse<RoundCounts>(((ComboBox)sender).Text, out rcount);
     _roundCount = rcount;
 }
Exemplo n.º 4
0
        private int GetRoundsSize(string KeyPath)
        {
            this.RoundCount = KeyHeader.GetRoundCount(KeyPath);

            if (this.RoundCount == RoundCounts.R8)
                return 8;
            else if (this.RoundCount == RoundCounts.R10)
                return 10;
            else if (this.RoundCount == RoundCounts.R12)
                return 12;
            else if (this.RoundCount == RoundCounts.R14)
                return 14;
            else if (this.RoundCount == RoundCounts.R16)
                return 16;
            else if (this.RoundCount == RoundCounts.R18)
                return 18;
            else if (this.RoundCount == RoundCounts.R20)
                return 20;
            else if (this.RoundCount == RoundCounts.R22)
                return 22;
            else if (this.RoundCount == RoundCounts.R24)
                return 24;
            else if (this.RoundCount == RoundCounts.R26)
                return 26;
            else if (this.RoundCount == RoundCounts.R28)
                return 28;
            else if (this.RoundCount == RoundCounts.R30)
                return 30;
            else if (this.RoundCount == RoundCounts.R32)
                return 32;
            else if (this.RoundCount == RoundCounts.R34)
                return 34;
            else if (this.RoundCount == RoundCounts.R38)
                return 38;
            else if (this.RoundCount == RoundCounts.R40)
                return 40;
            else if (this.RoundCount == RoundCounts.R42)
                return 42;
            else if (this.RoundCount == RoundCounts.R48)
                return 48;
            else if (this.RoundCount == RoundCounts.R56)
                return 56;
            else if (this.RoundCount == RoundCounts.R64)
                return 64;
            else if (this.RoundCount == RoundCounts.R80)
                return 80;
            else if (this.RoundCount == RoundCounts.R96)
                return 96;
            else if (this.RoundCount == RoundCounts.R128)
                return 128;
            else
                return 20;
        }
Exemplo n.º 5
0
 /// <summary>
 /// CipherDescription constructor
 /// </summary>
 /// 
 /// <param name="EngineType">The Cryptographic <see cref="SymmetricEngines">Engine</see> type</param>
 /// <param name="KeySize">The cipher Key Size in bytes</param>
 /// <param name="IvSize">Size of the cipher <see cref="IVSizes">Initialization Vector</see></param>
 /// <param name="CipherType">The type of <see cref="CipherModes">Cipher Mode</see></param>
 /// <param name="PaddingType">The type of cipher <see cref="PaddingModes">Padding Mode</see></param>
 /// <param name="BlockSize">The cipher <see cref="BlockSizes">Block Size</see></param>
 /// <param name="RoundCount">The number of diffusion <see cref="RoundCounts">Rounds</see></param>
 /// <param name="KdfEngine">The <see cref="Digests">Digest</see> engine used to power the key schedule Key Derivation Function in HX and M series ciphers</param>
 /// <param name="MacSize">The size of the HMAC message authentication code; a zeroed parameter means authentication is not enabled with this key</param>
 /// <param name="MacEngine">The HMAC <see cref="Digests">Digest</see> engine used to authenticate a message file encrypted with this key</param>
 /// 
 /// <exception cref="System.ArgumentOutOfRangeException">Thrown if an invalid KeyId, MessageKey, or ExtensionKey is used</exception>
 public CipherDescription(SymmetricEngines EngineType, int KeySize, IVSizes IvSize, CipherModes CipherType, PaddingModes PaddingType,
     BlockSizes BlockSize, RoundCounts RoundCount, Digests KdfEngine = Digests.SHA512, int MacSize = 64, Digests MacEngine = Digests.SHA512)
 {
     this.EngineType = (Int32)EngineType;
     this.KeySize = KeySize;
     this.IvSize = (Int32)IvSize;
     this.CipherType = (Int32)CipherType;
     this.PaddingType = (Int32)PaddingType;
     this.BlockSize = (Int32)BlockSize;
     this.RoundCount = (Int32)RoundCount;
     this.KdfEngine = (Int32)KdfEngine;
     this.MacSize = MacSize;
     this.MacEngine = (Int32)MacEngine;
 }