Skip to content

Commit

Permalink
Bump rPGP (#9)
Browse files Browse the repository at this point in the history
* Bump rPGP

* Fix spec

* Fix one more spec
  • Loading branch information
kzaitsev authored Dec 30, 2024
1 parent ccfc785 commit 2e0f640
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 49 deletions.
111 changes: 93 additions & 18 deletions ext/pgp_rb/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/pgp_rb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "1.0.0"
edition = "2021"

[dependencies]
pgp = "0.13.1"
pgp = "0.14.1"
rand = "0.8.5"
magnus = { git = "https://github.com/matsadler/magnus.git", default_features = false }
base64 = "0.21.7"
Expand Down
13 changes: 9 additions & 4 deletions ext/pgp_rb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use pgp::crypto::sym::SymmetricKeyAlgorithm;
use pgp::composed::message::ArmorOptions;

use pgp::types::KeyVersion;
use pgp::types::KeyTrait;
use pgp::types::PublicKeyTrait;

use std::io::Cursor;
use base64::{engine::general_purpose, Engine as _};
Expand Down Expand Up @@ -65,7 +65,7 @@ impl PgpPublicKey {
fn fingerprint(rb_self: &PgpPublicKey) -> String {
rb_self.signed_public_key
.fingerprint()
.iter()
.as_bytes().iter()
.map(|byte| format!("{:02x}", byte))
.collect::<String>()
.to_uppercase()
Expand All @@ -82,7 +82,11 @@ impl PgpPublicKey {
PublicKeyAlgorithm::ECDSA => Some(19),
PublicKeyAlgorithm::Elgamal => Some(20),
PublicKeyAlgorithm::DiffieHellman => Some(21),
PublicKeyAlgorithm::EdDSA => Some(22),
PublicKeyAlgorithm::EdDSALegacy => Some(22),
PublicKeyAlgorithm::X25519 => Some(25),
PublicKeyAlgorithm::X448 => Some(26),
PublicKeyAlgorithm::Ed25519 => Some(27),
PublicKeyAlgorithm::Ed448 => Some(28),
PublicKeyAlgorithm::Private100 => Some(100),
PublicKeyAlgorithm::Private101 => Some(101),
PublicKeyAlgorithm::Private102 => Some(102),
Expand Down Expand Up @@ -112,6 +116,7 @@ impl PgpPublicKey {
KeyVersion::V3 => Some(3),
KeyVersion::V4 => Some(4),
KeyVersion::V5 => Some(5),
KeyVersion::V6 => Some(6),
KeyVersion::Other(_) => None
}
}
Expand Down Expand Up @@ -142,7 +147,7 @@ impl PgpPublicKey {
};

let msg = Message::new_literal("", &input.to_string());
let encrypted = msg.encrypt_to_keys(
let encrypted = msg.encrypt_to_keys_seipdv1(
&mut rand::thread_rng(),
alg,
&[&rb_self.signed_public_key]
Expand Down
Loading

0 comments on commit 2e0f640

Please sign in to comment.