Exemple #1
0
 public void GuessKeyBitLength_throws_on_invalid_values(int bits)
 {
     Exceptions.AssertThrowsUnsupportedFeature(
         () => RsaKey.GuessKeyBitLength(new RSAParameters()
     {
         Modulus = new byte[bits / 8]
     }),
         "not supported");
 }
Exemple #2
0
 public void GuessKeyBitLength_guesses_correctly(int bits)
 {
     foreach (var i in new[] { bits * 3 / 4 + 8, bits - 16, bits - 8, bits })
     {
         var guessed = RsaKey.GuessKeyBitLength(new RSAParameters()
         {
             Modulus = new byte[i / 8]
         });
         Assert.Equal(bits, guessed);
     }
 }