code: public String decrypt(final byte[] text, final KeyType keyType) throws EncryptionException {
        final Key key = keyType == KeyType.PRIVATE ? privateKey : publicKey;
  
        try {
           // get an RSA cipher object and print the provider
           final Cipher cipher = Cipher.getInstance(ALGORITHM);
           // decrypt the text using the private key
           cipher.init(Cipher.DECRYPT_MODE, key);
           byte[] dectyptedText = cipher.doFinal(text);
  
           return new String(dectyptedText, DEFAULT_CHARSET);
        } catch (NoSuchAlgorithmException | InvalidKeyException | NoSuchPaddingException | BadPaddingException | IllegalBlockSizeException e) {
           throw new EncryptionException("Unable to decrypt message: ", e);
        }
     }
docs: Decrypts the given encrypted message with the specified key type.
  
  @param text
  The encrypted message to be decrypted.
  @param keyType
  The key type to be used.
  @return The decrypted message.
  @throws EncryptionException
  When it was not possible to decrypt the message.