Here you can find the source of getKeyString(Key key)
public static String getKeyString(Key key) throws Exception
//package com.java2s; //License from project: Open Source License import sun.misc.BASE64Encoder; import java.security.*; public class Main { public static String getKeyString(Key key) throws Exception { byte[] keyBytes = key.getEncoded(); return (new BASE64Encoder()).encode(keyBytes); }/*from w w w .java 2 s .c o m*/ }