diff --git a/client/client.go b/client/client.go
index 382c53dcb4a6f86b4158becca4756a96f342ed27..78e37029f33d27bef80aa2dcea6ea3ce23323362 100644
--- a/client/client.go
+++ b/client/client.go
@@ -16,6 +16,14 @@ import (
 	"golang.org/x/crypto/ssh/agent"
 )
 
+// InstallPublicFiles installs the public part of the cert and key.
+func InstallPublicFiles(c Config, cert *ssh.Certificate, pub PublicKey) error {
+	ioutil.WriteFile(client.ExpandTilde(c.PublicKey),
+		ssh.MarshalAuthorizedKey(pub), 0644)
+	ioutil.WriteFile(client.ExpandTilde(c.PublicCert),
+		[]byte(cert.Type()+" "+base64.StdEncoding.EncodeToString(cert.Marshal())), 0644)
+}
+
 // InstallCert adds the private key and signed certificate to the ssh agent.
 func InstallCert(a agent.Agent, cert *ssh.Certificate, key Key) error {
 	t := time.Unix(int64(cert.ValidBefore), 0)
diff --git a/cmd/cashier/main.go b/cmd/cashier/main.go
index 5e3484d9c05912eefdeb8abcbe18e4cea1fa6e8a..2e819531cac75f5fa79cf75d4359c8834fd06e5c 100644
--- a/cmd/cashier/main.go
+++ b/cmd/cashier/main.go
@@ -63,9 +63,8 @@ func main() {
 	if err := client.InstallCert(a, cert, priv); err != nil {
 		log.Fatalln(err)
 	}
-	ioutil.WriteFile(client.ExpandTilde(c.PublicKey),
-		ssh.MarshalAuthorizedKey(pub), 0644)
-	ioutil.WriteFile(client.ExpandTilde(c.PublicCert),
-		[]byte(cert.Type()+" "+base64.StdEncoding.EncodeToString(cert.Marshal())), 0644)
+	if err := client.InstallPublicFilis(c, cert, pub); err != nil {
+		log.Fatalln(err)
+	}
 	fmt.Println("Credentials added.")
 }