SSHKeyTestUtils.createDsaKeyPair(publicKeyPath, privateKeyPath);
ISSHPublicKey publicKey = new SSHPublicKey(publicKeyPath);
assertThat(publicKey.getKeyType()).isEqualTo(SSHKeyType.SSH_DSA);
String keyName = SSHKeyTestUtils.createRandomKeyName();
key = user.addSSHKey(keyName, publicKey);
SSHKeyPair keyPair = SSHKeyPair.create(
SSHKeyType.SSH_RSA, SSHKeyTestUtils.DEFAULT_PASSPHRASE, privateKeyPath, publicKeyPath);
// operation
key.setKeyType(SSHKeyType.SSH_RSA, keyPair.getPublicKey());
// verification
assertThat(key.getKeyType()).isEqualTo(SSHKeyType.SSH_RSA);
assertThat(key.getPublicKey()).isEqualTo(keyPair.getPublicKey());
} finally {
SSHKeyTestUtils.silentlyDestroyKey(key);
}
}