private static void ConfigureCryptography() { string mscorlibVersion = typeof(CryptoConfig).Assembly.GetName().Version.ToString(); using (XmlReader reader = ResourceUtils.GetXmlResource("OpenGost.Security.Cryptography.Tests.Crypto.config")) { var document = new XPathDocument(reader); XPathNavigator navigator = document.CreateNavigator(); XPathNodeIterator mscorlibIterator = navigator.Select("configuration/mscorlib"); XPathNavigator mscorlib = null; while (mscorlibIterator.MoveNext()) { bool versionSpecificMscorlib = false; XPathNavigator current = mscorlibIterator.Current; XPathNodeIterator versionAttributeIterator = current.Select("@version"); while (versionAttributeIterator.MoveNext()) { versionSpecificMscorlib = true; if (mscorlibVersion == versionAttributeIterator.Current.Value) { mscorlib = current; break; } } if (!versionSpecificMscorlib) { mscorlib = current; } if (mscorlib != null) { break; } } if (mscorlib == null) { return; } XPathNavigator cryptographySettings = mscorlib.SelectSingleNode("cryptographySettings"); if (cryptographySettings == null) { return; } XPathNavigator cryptoNameMapping = cryptographySettings.SelectSingleNode("cryptoNameMapping"); if (cryptoNameMapping != null) { ConfigureCryptoNameMapping(cryptoNameMapping); } XPathNavigator oidMap = cryptographySettings.SelectSingleNode("oidMap"); if (oidMap != null) { ConfigureOidMap(oidMap); } } }