error[E0432]: unresolved import `pgp::crypto::SymmetricKeyAlgorithm`
 --> src/main.rs:2:5
  |
2 | use pgp::crypto::SymmetricKeyAlgorithm;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `SymmetricKeyAlgorithm` in `crypto`
  |
help: consider importing this enum instead
  |
2 | use pgp::crypto::sym::SymmetricKeyAlgorithm;
  |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0432]: unresolved import `pgp::types::LiteralDataPart`
 --> src/main.rs:3:40
  |
3 | use pgp::types::{CompressionAlgorithm, LiteralDataPart};
  |                                        ^^^^^^^^^^^^^^^ no `LiteralDataPart` in `types`

error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> src/main.rs:28:19
    |
28  |     let message = Message::new_literal(literal_data);
    |                   ^^^^^^^^^^^^^^^^^^^^-------------- an argument of type `&str` is missing
    |
note: associated function defined here
   --> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgp-0.13.2/src/composed/message/types.rs:280:12
    |
280 |     pub fn new_literal(file_name: impl AsRef<BStr>, da...
    |            ^^^^^^^^^^^
help: provide the argument
    |
28  |     let message = Message::new_literal(literal_data, /* &str */);
    |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~

error[E0308]: mismatched types
   --> src/main.rs:37:9
    |
35  |     let encrypted_message = message.encrypt_to_keys(
    |                                     --------------- arguments to this method are incorrect
36  |         sym_algo,
37  |         compress_algo,
    |         ^^^^^^^^^^^^^ expected `SymmetricKeyAlgorithm`, found `CompressionAlgorithm`
    |
note: method defined here
   --> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgp-0.13.2/src/composed/message/types.rs:326:12
    |
326 |     pub fn encrypt_to_keys<R: CryptoRng + Rng>(
    |            ^^^^^^^^^^^^^^^

error[E0061]: this method takes 1 argument but 0 arguments were supplied
   --> src/main.rs:42:45
    |
42  | ...pted_message.to_armored_string()?;
    |                 ^^^^^^^^^^^^^^^^^-- an argument of type `ArmorOptions<'_>` is missing
    |
note: method defined here
   --> /home/ubuntu/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pgp-0.13.2/src/composed/message/types.rs:752:12
    |
752 |     pub fn to_armored_string(&self, opts: ArmorOptions...
    |            ^^^^^^^^^^^^^^^^^
help: provide the argument
    |
42  |     let armored_message = encrypted_message.to_armored_string(/* ArmorOptions<'_> */)?;
    |                                                              ~~~~~~~~~~~~~~~~~~~~~~~~

Some errors have detailed explanations: E0061, E0308, E0432.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `gpg4msg` (bin "gpg4msg") due to 5 previous errors
  // src/main.rs

use pgp::composed::message::Message;
use pgp::crypto::SymmetricKeyAlgorithm;
use pgp::types::{CompressionAlgorithm, LiteralDataPart};
use pgp::{Deserializable, SignedPublicKey};
use std::error::Error;
use std::fs::File;
use std::io::Read;

fn main() -> Result<(), Box<dyn Error>> {
    // Ruta a la clave pública
    let public_key_path = "ruta/a/tu_clave_publica.asc";
    // Mensaje a cifrar
    let mensaje = "Este es un mensaje secreto";

    // Cargar la clave pública
    let mut public_key_file = File::open(public_key_path)?;
    let mut public_key_content = String::new();
    public_key_file.read_to_string(&mut public_key_content)?;
    let (public_key, _) = SignedPublicKey::from_string(&public_key_content)?;

    // Convertir el mensaje a bytes
    let mensaje_bytes = mensaje.as_bytes().to_vec();

    // Crear la parte de datos literales
    let literal_data = LiteralDataPart::from_plain_text(mensaje_bytes);

    // Crear el mensaje literal
    let message = Message::new_literal(literal_data);

    // Especificar las preferencias de cifrado
    let sym_algo = SymmetricKeyAlgorithm::AES256;
    let compress_algo = CompressionAlgorithm::ZLIB;

    // Cifrar el mensaje con la clave pública
    let encrypted_message = message.encrypt_to_keys(
        sym_algo,
        compress_algo,
        &[&public_key],
    )?;

    // Serializar el mensaje cifrado a formato ASCII Armor
    let armored_message = encrypted_message.to_armored_string()?;

    // Mostrar el mensaje cifrado
    println!("{}", armored_message);

    Ok(())
}