コード例 #1
0
        private void CreateDecryptor(RootNodeInfo rootNodeInfo, XmlElement connectionsRootElement = null)
        {
            if (_confVersion >= 2.6)
            {
                BlockCipherEngines engine;
                Enum.TryParse(connectionsRootElement?.Attributes["EncryptionEngine"].Value, out engine);

                BlockCipherModes mode;
                Enum.TryParse(connectionsRootElement?.Attributes["BlockCipherMode"].Value, out mode);

                int keyDerivationIterations;
                int.TryParse(connectionsRootElement?.Attributes["KdfIterations"].Value, out keyDerivationIterations);

                _decryptor = new XmlConnectionsDecryptor(engine, mode, rootNodeInfo)
                {
                    AuthenticationRequestor = AuthenticationRequestor,
                    KeyDerivationIterations = keyDerivationIterations
                };
            }
            else
            {
                _decryptor = new XmlConnectionsDecryptor(_rootNodeInfo)
                {
                    AuthenticationRequestor = AuthenticationRequestor
                };
            }
        }
コード例 #2
0
        private void CreateDecryptor(RootNodeInfo rootNodeInfo, XmlElement connectionsRootElement = null)
        {
            if (_confVersion >= 2.6)
            {
                BlockCipherEngines engine;
                Enum.TryParse(connectionsRootElement?.Attributes["EncryptionEngine"].Value, out engine);

                BlockCipherModes mode;
                Enum.TryParse(connectionsRootElement?.Attributes["BlockCipherMode"].Value, out mode);

                int keyDerivationIterations;
                int.TryParse(connectionsRootElement?.Attributes["KdfIterations"].Value, out keyDerivationIterations);

                _decryptor = new XmlConnectionsDecryptor(engine, mode, rootNodeInfo)
                {
                    AuthenticationRequestor = AuthenticationRequestor,
                    KeyDerivationIterations = keyDerivationIterations
                };
            }
            else
            {
                _decryptor = new XmlConnectionsDecryptor(_rootNodeInfo) { AuthenticationRequestor = AuthenticationRequestor };
            }
        }