/// <summary>
        /// Create a new RSA key
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateRSAKey_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(PrivateRSAContainerName.Text))
            {
                ErrorTextBlock.Visibility = Visibility.Visible;
                ErrorTextBlock.Text       = "Provide a valid container name";
                return;
            }

            AsymmetricEncryption.CreateNewKeyPair(PrivateRSAContainerName.Text.Trim(), 4096);
        }
Ejemplo n.º 2
0
        public void GenerateKeyPAir_Returns_Valid_Public_Key()
        {
            RSAParameters rsaParameters = AsymmetricEncryption.CreateNewKeyPair(TestContainerName, 4096);

            // public exponent
            Assert.NotNull(rsaParameters.Exponent);
            CollectionAssert.IsNotEmpty(rsaParameters.Exponent);

            // modulus
            Assert.NotNull(rsaParameters.Modulus);
            CollectionAssert.IsNotEmpty(rsaParameters.Modulus);

            // private exponent
            Assert.IsNull(rsaParameters.D);
        }
Ejemplo n.º 3
0
        public void GenerateKeyPAir_Returns_Public_Key()
        {
            RSAParameters rsaParameters = AsymmetricEncryption.CreateNewKeyPair(TestContainerName, 4096);

            Assert.NotNull(rsaParameters);
        }
Ejemplo n.º 4
0
 public void SetUp()
 {
     publicKey = AsymmetricEncryption.CreateNewKeyPair(TestContainerName, 4096);
 }