summaryrefslogtreecommitdiffstats
path: root/openpgp/src/serialize.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/serialize.rs')
-rw-r--r--openpgp/src/serialize.rs44
1 files changed, 44 insertions, 0 deletions
diff --git a/openpgp/src/serialize.rs b/openpgp/src/serialize.rs
index c673b555..c92d45e0 100644
--- a/openpgp/src/serialize.rs
+++ b/openpgp/src/serialize.rs
@@ -969,6 +969,11 @@ impl Marshal for crypto::mpi::PublicKey {
w.write_all(&[3u8, 1u8, u8::from(*hash), u8::from(*sym)])?;
}
+ X25519 { u } => w.write_all(&u[..])?,
+ X448 { u } => w.write_all(&u[..])?,
+ Ed25519 { a } => w.write_all(&a[..])?,
+ Ed448 { a } => w.write_all(&a[..])?,
+
Unknown { ref mpis, ref rest } => {
for mpi in mpis.iter() {
mpi.serialize(w)?;
@@ -1010,6 +1015,11 @@ impl MarshalInto for crypto::mpi::PublicKey {
1 + curve.oid().len() + q.serialized_len() + 4
}
+ X25519 { .. } => 32,
+ X448 { .. } => 56,
+ Ed25519 { .. } => 32,
+ Ed448 { .. } => 57,
+
Unknown { ref mpis, ref rest } => {
mpis.iter().map(|mpi| mpi.serialized_len()).sum::<usize>()
+ rest.len()
@@ -1055,6 +1065,11 @@ impl Marshal for crypto::mpi::SecretKeyMaterial {
scalar.serialize(w)?;
}
+ X25519 { x } => w.write_all(x)?,
+ X448 { x } => w.write_all(x)?,
+ Ed25519 { x } => w.write_all(x)?,
+ Ed448 { x } => w.write_all(x)?,
+
Unknown { ref mpis, ref rest } => {
for mpi in mpis.iter() {
mpi.serialize(w)?;
@@ -1096,6 +1111,11 @@ impl MarshalInto for crypto::mpi::SecretKeyMaterial {
scalar.serialized_len()
}
+ X25519 { .. } => 32,
+ X448 { .. } => 56,
+ Ed25519 { .. } => 32,
+ Ed448 { .. } => 57,
+
Unknown { ref mpis, ref rest } => {
mpis.iter().map(|mpi| mpi.serialized_len()).sum::<usize>()
+ rest.len()
@@ -1158,6 +1178,16 @@ impl Marshal for crypto::mpi::Ciphertext {
write_field_with_u8_size(w, "Key", key)?;
}
+ X25519 { e, key } => {
+ w.write_all(&e[..])?;
+ write_field_with_u8_size(w, "Key", key)?;
+ }
+
+ X448 { e, key } => {
+ w.write_all(&e[..])?;
+ write_field_with_u8_size(w, "Key", key)?;
+ }
+
Unknown { ref mpis, ref rest } => {
for mpi in mpis.iter() {
mpi.serialize(w)?;
@@ -1186,6 +1216,14 @@ impl MarshalInto for crypto::mpi::Ciphertext {
e.serialized_len() + 1 + key.len()
}
+ X25519 { key, .. } => {
+ 32 + 1 + key.len()
+ }
+
+ X448 { key, .. } => {
+ 56 + 1 + key.len()
+ }
+
Unknown { ref mpis, ref rest } => {
mpis.iter().map(|mpi| mpi.serialized_len()).sum::<usize>()
+ rest.len()
@@ -1224,6 +1262,9 @@ impl Marshal for crypto::mpi::Signature {
s.serialize(w)?;
}
+ Ed25519 { s } => w.write_all(&s[..])?,
+ Ed448 { s } => w.write_all(&s[..])?,
+
Unknown { ref mpis, ref rest } => {
for mpi in mpis.iter() {
mpi.serialize(w)?;
@@ -1256,6 +1297,9 @@ impl MarshalInto for crypto::mpi::Signature {
r.serialized_len() + s.serialized_len()
}
+ Ed25519 { .. } => 64,
+ Ed448 { .. } => 114,
+
Unknown { ref mpis, ref rest } => {
mpis.iter().map(|mpi| mpi.serialized_len()).sum::<usize>()
+ rest.len()