Beispiel #1
0
        public CipherInfo(string name, int keySize, int ivSize, CipherFamily type, CipherStandardState state = CipherStandardState.Hidden)
        {
            Type          = type;
            Name          = name;
            StandardState = state;

            CipherParameter = new StreamCipherParameter
            {
                KeySize = keySize,
                IvSize  = ivSize,
            };
        }
        public StreamCrypto(string method, string password)
            : base(method, password)
        {
            CipherInfo   = GetCiphers()[method.ToLower()];
            cipherFamily = CipherInfo.Type;
            StreamCipherParameter parameter = (StreamCipherParameter)CipherInfo.CipherParameter;

            keyLen = parameter.KeySize;
            ivLen  = parameter.IvSize;

            InitKey(password);

            logger.Dump($"key {instanceId}", key, keyLen);
        }
Beispiel #3
0
        public CipherInfo(string name, int keySize, int saltSize, int nonceSize, int tagSize, CipherFamily type, CipherStandardState state = CipherStandardState.InUse)
        {
            Type          = type;
            Name          = name;
            StandardState = state;

            CipherParameter = new AEADCipherParameter
            {
                KeySize   = keySize,
                SaltSize  = saltSize,
                NonceSize = nonceSize,
                TagSize   = tagSize,
            };
        }
Beispiel #4
0
        public StreamCrypto(string method, string password)
            : base(method, password)
        {
            CipherInfo   = GetCiphers()[method.ToLower()];
            cipherFamily = CipherInfo.Type;
            StreamCipherParameter parameter = (StreamCipherParameter)CipherInfo.CipherParameter;

            keyLen = parameter.KeySize;
            ivLen  = parameter.IvSize;

            InitKey(password);

            this.Log().Debug($"key {instanceId} {key} {keyLen}");
        }
        public AEADCrypto(string method, string password)
            : base(method, password)
        {
            CipherInfo   = GetCiphers()[method.ToLower()];
            cipherFamily = CipherInfo.Type;
            AEADCipherParameter parameter = (AEADCipherParameter)CipherInfo.CipherParameter;

            keyLen   = parameter.KeySize;
            saltLen  = parameter.SaltSize;
            tagLen   = parameter.TagSize;
            nonceLen = parameter.NonceSize;

            InitKey(password);

            salt = new byte[saltLen];
            // Initialize all-zero nonce for each connection
            nonce = new byte[nonceLen];

            this.Log().Debug($"masterkey {instanceId} {masterKey} {keyLen}");
            this.Log().Debug($"nonce {instanceId} {nonce} {keyLen}");
        }