Ejemplo n.º 1
0
        /// <summary>
        /// Gets a textual representation of the certificate template cryptography settings.
        /// </summary>
        /// <returns>A textual representation of the certificate template cryptography settings</returns>
        public override String ToString()
        {
            String        nl = Environment.NewLine;
            StringBuilder SB = new StringBuilder();

            SB.Append($"[Cryptography Settings]{nl}");
            SB.Append("  CSP list: ");
            if (CSPList == null)
            {
                SB.Append($"Any installed CSP{nl}");
            }
            else
            {
                SB.Append(nl);
                foreach (String csp in CSPList)
                {
                    SB.Append($"     {csp}{nl}");
                }
                SB.Append(nl);
            }
            SB.Append($"  Key Algorithm: {KeyAlgorithm.Format(true)}{nl}");
            SB.Append($"  Hash Algorithm: {HashAlgorithm.Format(true)}{nl}");
            SB.Append($"  Key Length: {MinimalKeyLength}{nl}");
            SB.Append($"  Private key options: {PrivateKeyOptions}{nl}");
            SB.Append($"  KeySpec: {KeySpec}{nl}");
            SB.Append($"  CNG key usage: {CNGKeyUsage}");
            if (!String.IsNullOrEmpty(PrivateKeySecuritySDDL))
            {
                SB.Append($"{nl}  Private key security descriptor: {PrivateKeySecuritySDDL}");
            }
            return(SB.ToString());
        }