Java Key Create getKeyString(Key key)

Here you can find the source of getKeyString(Key key)

Description

get Key String

License

Apache License

Declaration

public static String getKeyString(Key key) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.security.Key;

import sun.misc.BASE64Encoder;

public class Main {

    public static String getKeyString(Key key) {
        byte[] keyBytes = key.getEncoded();
        String s = (new BASE64Encoder()).encode(keyBytes);
        //      String s=null;
        //      try {
        //         s = new String(Base64.getDecoder().decode(keyBytes), "utf-8");
        //      } catch (UnsupportedEncodingException e) {
        //         e.printStackTrace();
        //      }
        return s;
    }//from  w ww . j  av  a2 s.  co  m
}

Related

  1. getKeyStore(String ksType, String file, String ksPassword)
  2. getKeyStore(String path, String passwd, String storeType)
  3. getKeyStoreFromFile(String filePath, char[] password)
  4. getKeyStoreFromFile(String keystoreName, String password, String home)
  5. getKeyStores()
  6. getKeyString(Key key)