Code example for SecretKeySpec

Methods: getEncoded

0
     
    public String keyToString(SecretKeySpec key){
    	 
    	if (isDummyKey(key))
    		return(SERIALIZED_DUMMY_KEY);
    	byte [] keyBytes = key.getEncoded();
    	byte [] encodedBytes = Base64.encodeBase64(keyBytes);
    	 
    	String encodedString = new String(encodedBytes);
    	 
    	//log.info("format:SecretKeySpec" + key.getFormat() + ", base64 is " + encodedString); 
	    return(encodedString);
    	 
    } 
    public String keyToString(DummyKeySpec key){
    	//log.info("key to string for DummyKeySpec"); 
    	return(SERIALIZED_DUMMY_KEY);
    } 
    public String keyToString(DummyKey key){
    	//log.info("key to string for DummyKey"); 
    	return(SERIALIZED_DUMMY_KEY);