Exemplo n.º 1
0
 private static AS4EncryptedKey GetEncryptedKey(
     byte[] symmetricKey,
     KeyEncryptionConfiguration keyEncryptionConfig)
 {
     return
         (AS4EncryptedKey.CreateEncryptedKeyBuilderForKey(symmetricKey, keyEncryptionConfig)
          .Build());
 }
Exemplo n.º 2
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());
            }
Exemplo n.º 3
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());
            }