AccountApi: Add SSH key methods

Add methods to list the SSH keys, and add an SSH key.

Change-Id: Ie3e058ea8ecab5dff11678570f81cc7742a26c3f
This commit is contained in:
David Pursehouse
2016-03-16 19:11:29 +09:00
parent 34d7eb1f3e
commit aaa2d828d8
4 changed files with 70 additions and 2 deletions

View File

@@ -160,12 +160,12 @@ public class AccountCreator {
return new AccountExternalId.Key(AccountExternalId.SCHEME_MAILTO, email);
}
private static KeyPair genSshKey() throws JSchException {
public static KeyPair genSshKey() throws JSchException {
JSch jsch = new JSch();
return KeyPair.genKeyPair(jsch, KeyPair.RSA);
}
private static String publicKey(KeyPair sshKey, String comment)
public static String publicKey(KeyPair sshKey, String comment)
throws UnsupportedEncodingException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
sshKey.writePublicKey(out, comment);