code: public String encrypt(String keyId, String message) {
  		final Key key = keyMap.get(keyId);
  
  		if (key == null) {
  			throw new AsymmetricEncryptionException("key not found: keyId=" + keyId);
  		}
  
  		try {
  			final Cipher cipher = (((provider == null) || (provider.length() == 0)) ? Cipher.getInstance(algorithm) : Cipher
  					.getInstance(algorithm, provider));
  			switch (mode) {
  				case ENCRYPT:
  					final byte[] messageAsByteArray = message.getBytes(charsetName);
  					cipher.init(Cipher.ENCRYPT_MODE, key);
  					return Base64.encodeBase64String(cipher.doFinal(messageAsByteArray));
  				case DECRYPT:
  					final byte[] encryptedMessage = Base64.decodeBase64(message);
  					cipher.init(Cipher.DECRYPT_MODE, key);
  					return new String(cipher.doFinal(encryptedMessage), charsetName);
  				default:
  					return null;
  			}
  		} catch (Exception e) {
  			throw new AsymmetricEncryptionException("error encrypting/decrypting message; mode=" + mode, e);
  		}
  	}
docs: Encrypts/decrypts a message based on the underlying mode of operation.
  
  @param keyId the key id
  @param message if in encryption mode, the clear-text message, otherwise
  the base64 encoded message to decrypt
  @return if in encryption mode, the base64 encoded encrypted message,
  otherwise the decrypted message
  @throws AsymmetricEncryptionException on runtime errors
  @see #setMode(Mode)