### Question:
DSAKeys { public static String encodeAsOpenSSH(DSAPublicKey key) { DSAParams params = key.getParams(); byte[] keyBlob = keyBlob(params.getP(), params.getQ(), params.getG(), key.getY()); return "ssh-dss " + base64().encode(keyBlob); }  static String encodeAsOpenSSH(DSAPublicKey key); static DSAPublicKeySpec publicKeySpecFromOpenSSH(String idDsaPub); static DSAPublicKeySpec publicKeySpecFromOpenSSH(ByteSource supplier); static String fingerprintPublicKey(String publicKeyOpenSSH); static String fingerprint(BigInteger p, BigInteger q, BigInteger g, BigInteger y);  }### Answer:
@Test public void testEncodeAsOpenSSH() throws IOException, InvalidKeySpecException, NoSuchAlgorithmException { String dsa = Strings2.toStringAndClose(getClass().getResourceAsStream("/ssh-dsa.pub")); DSAPublicKeySpec spec = DSAKeys.publicKeySpecFromOpenSSH(dsa); DSAPublicKey key = (DSAPublicKey) KeyFactory.getInstance("DSA").generatePublic(spec); assertEquals(DSAKeys.encodeAsOpenSSH(key), dsa); }