示例#1
0
            public void ThenCreateAS4EncryptedKeySucceeds()
            {
                byte[] encryptionKey = GenerateEncryptionKey();

                AS4EncryptedKey key =
                    AS4EncryptedKey.CreateEncryptedKeyBuilderForKey(encryptionKey, new KeyEncryptionConfiguration(GetCertificate())).Build();

                Assert.Equal(EncryptionStrategy.XmlEncRSAOAEPUrlWithMgf, key.GetEncryptionAlgorithm());
                Assert.Equal(EncryptionStrategy.XmlEncSHA256Url, key.GetDigestAlgorithm());
            }
示例#2
0
            public void ThenCreateAS4EncryptedKeySucceeds(string algorithm, string digest, string mgf)
            {
                byte[] encryptionKey = GenerateEncryptionKey();

                var keyEncryption = new KeyEncryption
                {
                    TransportAlgorithm = algorithm,
                    DigestAlgorithm    = digest,
                    MgfAlgorithm       = mgf
                };

                var keyEncryptionConfiguration = new KeyEncryptionConfiguration(GetCertificate(), keyEncryption);

                AS4EncryptedKey key =
                    AS4EncryptedKey.CreateEncryptedKeyBuilderForKey(encryptionKey, keyEncryptionConfiguration)
                    .Build();

                Assert.Equal(algorithm, key.GetEncryptionAlgorithm());
                Assert.Equal(digest, key.GetDigestAlgorithm());
                Assert.Equal(mgf, key.GetMaskGenerationFunction());
            }