Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountKey"/> class.
 /// </summary>
 /// <param name="keyInfo">The key information.</param>
 /// <exception cref="System.NotSupportedException">
 /// If the provided key is not one of the supported <seealso cref="SignatureAlgorithm"/>.
 /// </exception>
 public AccountKey(KeyInfo keyInfo = null)
 {
     if (keyInfo == null)
     {
         this.keyPair   = SignatureAlgorithm.Sha256WithRsaEncryption.Create();
         this.Algorithm = SignatureAlgorithm.Sha256WithRsaEncryption;
     }
     else
     {
         this.keyPair = keyInfo.CreateKeyPair();
         if (this.keyPair.Private is RsaPrivateCrtKeyParameters)
         {
             this.Algorithm = SignatureAlgorithm.Sha256WithRsaEncryption;
         }
         else
         {
             throw new NotSupportedException();
         }
     }
 }