Beispiel #1
0
        /// <summary>
        /// Encrypts the specified text for <paramref name="recipient"/> Card.
        /// </summary>
        /// <param name="recipient">The list of <see cref="VirgilCard"/> recipients.</param>
        /// <param name="plaintext">The plaintext to be encrypted.</param>
        /// <returns>A new <see cref="VirgilBuffer"/> with encrypted data.</returns>
        /// <exception cref="ArgumentNullException"></exception>
        public static VirgilBuffer Encrypt(this VirgilCard recipient, string plaintext)
        {
            if (string.IsNullOrWhiteSpace(plaintext))
            {
                throw new ArgumentException(Localization.ExceptionArgumentIsNullOrWhitespace, nameof(plaintext));
            }

            return(recipient.Encrypt(VirgilBuffer.From(plaintext)));
        }
Beispiel #2
0
 /// <summary>
 /// Encrypts the specified text for <paramref name="recipient"/> Card.
 /// </summary>
 /// <param name="recipient">The list of <see cref="VirgilCard"/> recipients.</param>
 /// <param name="bytes">The byte array to be encrypted.</param>
 /// <returns>A new <see cref="VirgilBuffer"/> with encrypted data.</returns>
 /// <exception cref="ArgumentNullException"></exception>
 public static VirgilBuffer Encrypt(this VirgilCard recipient, byte[] bytes)
 {
     return(recipient.Encrypt(new VirgilBuffer(bytes)));
 }