Skip to content

Commit

Permalink
Merge pull request #590 from docker/yubi-import-check
Browse files Browse the repository at this point in the history
Move yubikey import role check to avoid excessive passphrase prompting
  • Loading branch information
riyazdf committed Feb 25, 2016
2 parents e692e5d + d69d018 commit 4904c88
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions trustmanager/yubikey/yubikeystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -765,15 +765,15 @@ func (s *YubiKeyStore) ExportKey(keyID string) ([]byte, error) {
// ImportKey imports a root key into a Yubikey
func (s *YubiKeyStore) ImportKey(pemBytes []byte, keyPath string) error {
logrus.Debugf("Attempting to import: %s key inside of YubiKeyStore", keyPath)
if keyPath != data.CanonicalRootRole {
return fmt.Errorf("yubikey only supports storing root keys")
}
privKey, _, err := trustmanager.GetPasswdDecryptBytes(
s.passRetriever, pemBytes, "", "imported root")
if err != nil {
logrus.Debugf("Failed to get and retrieve a key from: %s", keyPath)
return err
}
if keyPath != data.CanonicalRootRole {
return fmt.Errorf("yubikey only supports storing root keys")
}
_, err = s.addKey(privKey.ID(), "root", privKey)
return err
}
Expand Down

0 comments on commit 4904c88

Please sign in to comment.