コード例 #1
0
        private void StartGenerateKeys()
        {
            options.RsaKeyLength = generateKeysForm.RsaKeyLength;
            var key = keyGenerator.Generate(options.RsaKeyLength, BigNumber.FromInt(options.PublicExponent));

            generateKeysForm.GenerateEnabled = true;
            if (key == null)
            {
                messageHelper.Show("Unable to generate a key.", "Не удалось сгенерировать ключ.");
                return;
            }
            var serializer = new KeySerializer(new BigNumberHexSerializer());

            generateKeysForm.PublicKey  = serializer.SerializePublicKey(key.PublicKey);
            generateKeysForm.PrivateKey = serializer.SerializePrivateKey(key.PrivateKey);
        }
コード例 #2
0
 public void SerializePublicKey_KeyIsNull()
 {
     Assert.Throws(typeof(ArgumentNullException), () => serializer.SerializePublicKey(null));
 }