/// <summary>
        /// Fills in missing optional private key data.
        /// </summary>
        /// <param name="rsa">The <see cref="RSAParameters"/> that contain a private key but not the optional parameters.</param>
        /// <returns>The fully populated private key data.</returns>
        internal static RSAParameters ComputeFullPrivateKeyData(this RSAParameters rsa)
        {
            if (rsa.HasFullPrivateKeyData())
            {
                return(rsa);
            }

            return(Create(rsa.P !, rsa.Q !, rsa.Exponent !, rsa.Modulus !));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fills in missing optional private key data.
        /// </summary>
        /// <param name="rsa">The <see cref="RSAParameters"/> that contain a private key but not the optional parameters.</param>
        /// <returns>The fully populated private key data.</returns>
        internal static RSAParameters ComputeFullPrivateKeyData(this RSAParameters rsa)
        {
            if (rsa.HasFullPrivateKeyData())
            {
                return(rsa);
            }

#if SILVERLIGHT
            throw new NotSupportedException("Silverlight does not allow calculating missing RSA private key data.");
#else
            return(Create(rsa.P, rsa.Q, rsa.Exponent, rsa.Modulus));
#endif
        }