/// <summary>
        /// Passphrase callback method. Invoked if a action requires the user's password.
        /// </summary>
        /// <param name="ctx">Context that has invoked the callback.</param>
        /// <param name="info">Information about the key.</param>
        /// <param name="passwd">User supplied password.</param>
        /// <returns></returns>
        public static PassphraseResult MyNewPassphraseCallback(
            Context ctx,
            PassphraseInfo info,
            ref char[] passwd)
        {
            Console.Write("Please enter your new passphrase.\n"
                          + "Uid: " + info.Uid
                          + "\nKey id: " + info.UidKeyId
                          + "\nNew password: ");

            passwd = Console.ReadLine().ToCharArray();

            return(PassphraseResult.Success);
        }
        /// <summary>
        /// Passphrase callback method. Invoked if a action requires the user's password.
        /// </summary>
        /// <param name="ctx">Context that has invoked the callback.</param>
        /// <param name="info">Information about the key.</param>
        /// <param name="passwd">User supplied password.</param>
        /// <returns></returns>
        public static PassphraseResult MyPassphraseCallback(
            Context ctx,
            PassphraseInfo info,
            ref char[] passwd)
        {
            Console.Write("You need to enter your passphrase.\n"
                          + "Uid: " + info.Uid
                          + "\nKey id: " + info.UidKeyId
                          + "\nPrevious passphrase was bad: " + info.PrevWasBad
                          + "\nPassword: ");

            passwd = Console.ReadLine().ToCharArray();

            return(PassphraseResult.Success);
        }
예제 #3
0
        /// <summary>
        /// Passphrase callback method. Invoked if a action requires the user's password.
        /// </summary>
        /// <param name="ctx">Context that has invoked the callback.</param>
        /// <param name="info">Information about the key.</param>
        /// <param name="passwd">User supplied password.</param>
        /// <returns></returns>
        public static PassphraseResult StaticNewPassphraseCallback(
            Context ctx,
            PassphraseInfo info,
            ref char[] passwd)
        {
            Console.Write("Please enter your new passphrase.\n"
                          + "Uid: " + info.Uid
                          + "\nKey id: " + info.UidKeyId
                          + "\nNew password: ");

            var read_line = Console.ReadLine();

            if (read_line != null)
            {
                passwd = read_line.ToCharArray();
                return(PassphraseResult.Success);
            }

            return(PassphraseResult.Canceled);
        }
예제 #4
0
        /// <summary>
        /// Passphrase callback method. Invoked if a action requires the user's password.
        /// </summary>
        /// <param name="ctx">Context that has invoked the callback.</param>
        /// <param name="info">Information about the key.</param>
        /// <param name="passwd">User supplied password.</param>
        /// <returns></returns>
        public static PassphraseResult StaticOldPassphraseCallback(
            Context ctx,
            PassphraseInfo info,
            ref char[] passwd)
        {
            Console.Write("You need to enter your current passphrase.\n"
                          + "Uid: " + info.Uid
                          + "\nKey id: " + info.UidKeyId
                          + "\nPrevious passphrase was bad: " + info.PrevWasBad
                          + "\nPassword: ");

            var read_line = Console.ReadLine();

            if (read_line != null)
            {
                passwd = read_line.ToCharArray();
                return(PassphraseResult.Success);
            }

            return(PassphraseResult.Canceled);
        }
예제 #5
0
 public BadPassphraseException(PassphraseInfo info)
 {
     PassphraseInfo = info;
 }
예제 #6
0
 public EmptyPassphraseException(PassphraseInfo info)
 {
     PassphraseInfo = info;
 }