encrypt :: PublicKey -> BS.ByteString -> IO Encrypted
encrypt publicKey input = withOpenSSL $
      -- AES-CBC requires us to pad the input message if the messages are/can be
      -- of variable length.
  let pad :: BS.ByteString -> BS.ByteString
      pad = Pad.padPKCS5 paddingBytes

  in do
    cipher <- getCipher

    (encrypted, [encKey], inputVector) <- Seal.sealBS cipher [PKey.fromPublicKey publicKey] (pad input)

    return (Encrypted encrypted encKey inputVector)
encrypt :: PublicKey -> BS.ByteString -> IO Encrypted
encrypt publicKey input = withOpenSSL $
      -- AES-CBC requires us to pad the input message if the messages are/can be
      -- of variable length.
  let pad :: BS.ByteString -> BS.ByteString
      pad = Pad.padPKCS5 paddingBytes

  in do
    cipher <- getCipher

    (encrypted, [encKey], inputVector) <- Seal.sealBS cipher [PKey.fromPublicKey publicKey] (pad input)

    return (Encrypted encrypted encKey inputVector)
encrypt publicKey input = withOpenSSL $
      -- AES-CBC requires us to pad the input message if the messages are/can be
      -- of variable length.
  let pad :: BS.ByteString -> BS.ByteString
      pad = Pad.padPKCS5 paddingBytes

  in do
    cipher <- getCipher

    (encrypted, [encKey], inputVector) <- Seal.sealBS cipher [PKey.fromPublicKey publicKey] (pad input)

    return (Encrypted encrypted encKey inputVector)