SSH1 private key loader
Inheritance: ISSH1PrivateKeyLoader
Ejemplo n.º 1
0
        /// <summary>
        /// Read SSH1 private key parameters.
        /// </summary>
        /// <param name="passphrase">passphrase for decrypt the key file</param>
        /// <param name="modulus">private key parameter is set</param>
        /// <param name="publicExponent">private key parameter is set</param>
        /// <param name="privateExponent">private key parameter is set</param>
        /// <param name="primeP">private key parameter is set</param>
        /// <param name="primeQ">private key parameter is set</param>
        /// <param name="crtCoefficient">private key parameter is set</param>
        /// <param name="comment">comment</param>
        /// <exception cref="SSHException">failed to parse</exception>
        public void LoadSSH1PrivateKey(
            string passphrase,
            out BigInteger modulus,
            out BigInteger publicExponent,
            out BigInteger privateExponent,
            out BigInteger primeP,
            out BigInteger primeQ,
            out BigInteger crtCoefficient,
            out string comment)
        {
            PrivateKeyFileFormat format = ProbeFormat();

            ISSH1PrivateKeyLoader loader;

            if (format == PrivateKeyFileFormat.SSH1)
            {
                loader = new SSH1PrivateKeyLoader(keyFile, keyFilePath);
            }
            else
            {
                throw new SSHException(Strings.GetString("UnsupportedPrivateKeyFormat"));
            }

            loader.Load(passphrase, out modulus, out publicExponent, out privateExponent, out primeP, out primeQ, out crtCoefficient, out comment);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Read SSH1 private key parameters.
        /// </summary>
        /// <param name="passphrase">passphrase for decrypt the key file</param>
        /// <param name="modulus">private key parameter is set</param>
        /// <param name="publicExponent">private key parameter is set</param>
        /// <param name="privateExponent">private key parameter is set</param>
        /// <param name="primeP">private key parameter is set</param>
        /// <param name="primeQ">private key parameter is set</param>
        /// <param name="crtCoefficient">private key parameter is set</param>
        /// <param name="comment">comment</param>
        /// <exception cref="SSHException">failed to parse</exception>
        public void LoadSSH1PrivateKey(
            string passphrase,
            out BigInteger modulus,
            out BigInteger publicExponent,
            out BigInteger privateExponent,
            out BigInteger primeP,
            out BigInteger primeQ,
            out BigInteger crtCoefficient,
            out string comment)
        {
            PrivateKeyFileFormat format = ProbeFormat();

            ISSH1PrivateKeyLoader loader;
            if (format == PrivateKeyFileFormat.SSH1)
                loader = new SSH1PrivateKeyLoader(keyFile, keyFilePath);
            else
                throw new SSHException(Strings.GetString("UnsupportedPrivateKeyFormat"));

            loader.Load(passphrase, out modulus, out publicExponent, out privateExponent, out primeP, out primeQ, out crtCoefficient, out comment);
        }