Example #1
0
        private void SetSigningAlgorithm(string signingAlgorithm)
        {
            var algorithm = SignatureAlgorithmProvider.Get(signingAlgorithm);

            SignedInfo.SignatureMethod = algorithm.GetIdentifier();

            CryptoConfig.AddAlgorithm(algorithm.GetType(), algorithm.GetIdentifier());
        }
            public void ThenGetRsaSha512SignatureAlgorithmFromProviderSucceedsForNamespace()
            {
                // Arrange
                const string key = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";

                // Act
                SignatureAlgorithm signatureAlgorithm = SignatureAlgorithmProvider.Get(key);

                // Assert
                Assert.NotNull(signatureAlgorithm);
                Assert.IsType <RsaPkCs1Sha512SignatureAlgorithm>(signatureAlgorithm);
            }
            public void ThenGetRsaSha384SignatureAlgorithmFromProviderSucceedsForXmlDocument()
            {
                // Arrange
                const string key         = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";
                XmlDocument  xmlDocument = GetEnvelopeDocument(key);

                // Act
                SignatureAlgorithm signatureAlgorithm = SignatureAlgorithmProvider.Get(xmlDocument);

                // Assert
                Assert.NotNull(signatureAlgorithm);
                Assert.IsType <RsaPkCs1Sha384SignatureDescription>(signatureAlgorithm);
            }