// 1: identify the algorithm
buf.putRawPublicKey(publicKey);
String alg = buf.getString();
// 2: encode the key
buf.clear();
buf.putPublicKey(publicKey);
String b64 = Base64.encodeBase64String(buf.getBytes());
String c = getComment();
rawData = alg + " " + b64 + (StringUtils.isEmpty(c) ? "" : (" " + c));