Esempio n. 1
0
            /// <summary>
            /// Returns *.config file XML section representing this public key
            /// </summary>
            public string ToConfigSection()
            {
                StringBuilder sb = new StringBuilder();

                {
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyModulus, this.Modulus));
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyExponent, this.Exponent));
                }
                return(sb.ToString());
            }
Esempio n. 2
0
 /// <summary>
 /// Loads the private key from its XML string
 /// </summary>
 public void LoadFromXml(string keyXml)
 {
     this.Modulus         = EncryptionExtensions.GetXmlElement(keyXml, "Modulus");
     this.Exponent        = EncryptionExtensions.GetXmlElement(keyXml, "Exponent");
     this.PrimeP          = EncryptionExtensions.GetXmlElement(keyXml, "P");
     this.PrimeQ          = EncryptionExtensions.GetXmlElement(keyXml, "Q");
     this.PrimeExponentP  = EncryptionExtensions.GetXmlElement(keyXml, "DP");
     this.PrimeExponentQ  = EncryptionExtensions.GetXmlElement(keyXml, "DQ");
     this.Coefficient     = EncryptionExtensions.GetXmlElement(keyXml, "InverseQ");
     this.PrivateExponent = EncryptionExtensions.GetXmlElement(keyXml, "D");
 }
Esempio n. 3
0
 /// <summary>
 /// Load private key from App.config or Web.config file
 /// </summary>
 public void LoadFromConfig()
 {
     this.Modulus         = EncryptionExtensions.GetConfigString(_KeyModulus);
     this.Exponent        = EncryptionExtensions.GetConfigString(_KeyExponent);
     this.PrimeP          = EncryptionExtensions.GetConfigString(_KeyPrimeP);
     this.PrimeQ          = EncryptionExtensions.GetConfigString(_KeyPrimeQ);
     this.PrimeExponentP  = EncryptionExtensions.GetConfigString(_KeyPrimeExponentP);
     this.PrimeExponentQ  = EncryptionExtensions.GetConfigString(_KeyPrimeExponentQ);
     this.Coefficient     = EncryptionExtensions.GetConfigString(_KeyCoefficient);
     this.PrivateExponent = EncryptionExtensions.GetConfigString(_KeyPrivateExponent);
 }
Esempio n. 4
0
            /// <summary>
            /// Converts this public key to its XML string representation
            /// </summary>
            public string ToXml()
            {
                StringBuilder sb = new StringBuilder();

                {
                    sb.Append(EncryptionExtensions.WriteXmlNode(_ElementParent));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementModulus, this.Modulus));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementExponent, this.Exponent));
                    sb.Append(EncryptionExtensions.WriteXmlNode(_ElementParent, true));
                }
                return(sb.ToString());
            }
Esempio n. 5
0
            /// <summary>
            /// Returns *.config file XML section representing this private key
            /// </summary>
            public string ToConfigSection()
            {
                StringBuilder sb = new StringBuilder();

                {
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyModulus, this.Modulus));
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyExponent, this.Exponent));
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyPrimeP, this.PrimeP));
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyPrimeQ, this.PrimeQ));
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyPrimeExponentP, this.PrimeExponentP));
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyPrimeExponentQ, this.PrimeExponentQ));
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyCoefficient, this.Coefficient));
                    sb.Append(EncryptionExtensions.WriteConfigKey(_KeyPrivateExponent, this.PrivateExponent));
                }
                return(sb.ToString());
            }
Esempio n. 6
0
            /// <summary>
            /// Converts this private key to its XML string representation
            /// </summary>
            public string ToXml()
            {
                StringBuilder sb = new StringBuilder();

                {
                    sb.Append(EncryptionExtensions.WriteXmlNode(_ElementParent));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementModulus, this.Modulus));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementExponent, this.Exponent));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementPrimeP, this.PrimeP));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementPrimeQ, this.PrimeQ));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementPrimeExponentP, this.PrimeExponentP));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementPrimeExponentQ, this.PrimeExponentQ));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementCoefficient, this.Coefficient));
                    sb.Append(EncryptionExtensions.WriteXmlElement(_ElementPrivateExponent, this.PrivateExponent));
                    sb.Append(EncryptionExtensions.WriteXmlNode(_ElementParent, true));
                }
                return(sb.ToString());
            }
Esempio n. 7
0
 /// <summary>
 /// Load public key from App.config or Web.config file
 /// </summary>
 public void LoadFromConfig()
 {
     this.Modulus  = EncryptionExtensions.GetConfigString(_KeyModulus);
     this.Exponent = EncryptionExtensions.GetConfigString(_KeyExponent);
 }
Esempio n. 8
0
 /// <summary>
 /// Loads the public key from its XML string
 /// </summary>
 public void LoadFromXml(string keyXml)
 {
     this.Modulus  = EncryptionExtensions.GetXmlElement(keyXml, "Modulus");
     this.Exponent = EncryptionExtensions.GetXmlElement(keyXml, "Exponent");
 }