Merge pull request #20 from docker/passphrase_messaging

improve password challenge messaging when using yubikey

Signed-off-by: David Lawrence <david.lawrence@docker.com>

Signed-off-by: Diogo Mónica <diogo.monica@gmail.com> (github: endophage)
This commit is contained in:
Diogo Mónica 2015-11-03 22:01:55 +00:00 committed by David Lawrence
commit 7c6cc7d34c
2 changed files with 4 additions and 2 deletions

View File

@ -125,8 +125,10 @@ func PromptRetrieverWithInOut(in io.Reader, out io.Writer, aliasMap map[string]s
if createNew {
fmt.Fprintf(out, "Enter passphrase for new %s key with id %s: ", displayAlias, keyName)
} else if displayAlias == "yubikey" {
fmt.Fprintf(out, "Enter the %s for the attached Yubikey: ", keyName)
} else {
fmt.Fprintf(out, "Enter key passphrase for %s key with id %s: ", displayAlias, keyName)
fmt.Fprintf(out, "Enter passphrase for %s key with id %s: ", displayAlias, keyName)
}
passphrase, err := stdin.ReadBytes('\n')

View File

@ -387,7 +387,7 @@ func login(ctx *pkcs11.Ctx, session pkcs11.SessionHandle, passRetriever passphra
if userFlag == pkcs11.CKU_SO {
user = "SO Pin"
} else {
user = "Pin"
user = "User Pin"
}
passwd, giveup, err := passRetriever(user, "yubikey", false, attempts)
// Check if the passphrase retriever got an error or if it is telling us to give up