code: public byte[] encrypt(String keyId, byte[] 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:
  					cipher.init(Cipher.ENCRYPT_MODE, key);
  					break;
  				case DECRYPT:
  					cipher.init(Cipher.DECRYPT_MODE, key);
  					break;
  				default:
  					throw new AsymmetricEncryptionException("error encrypting/decrypting message: invalid mode; mode="
  							+ mode);
  			}
  			return cipher.doFinal(message);
  		} 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 message to decrypt
  @return if in encryption mode, the encrypted message, otherwise the
  decrypted message
  @throws AsymmetricEncryptionException on runtime errors
  @see #setMode(Mode)