summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/mpi.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/crypto/mpi.rs')
-rw-r--r--openpgp/src/crypto/mpi.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/openpgp/src/crypto/mpi.rs b/openpgp/src/crypto/mpi.rs
index 1f19b382..6b5bec4b 100644
--- a/openpgp/src/crypto/mpi.rs
+++ b/openpgp/src/crypto/mpi.rs
@@ -55,8 +55,15 @@ impl MPI {
}
}
- /// Creates new MPI for EC point.
- pub fn new_weierstrass(x: &[u8], y: &[u8], field_bits: usize) -> Self {
+ /// Creates new MPI encoding an uncompressed EC point.
+ ///
+ /// Encodes the given point on a elliptic curve (see [Section 6 of
+ /// RFC 6637] for details). This is used to encode public keys
+ /// and ciphertexts for the NIST curves (`NistP256`, `NistP384`,
+ /// and `NistP521`).
+ ///
+ /// [Section 6 of RFC 6637]: https://tools.ietf.org/html/rfc6637#section-6
+ pub fn new_point(x: &[u8], y: &[u8], field_bits: usize) -> Self {
let field_sz = if field_bits % 8 > 0 { 1 } else { 0 } + field_bits / 8;
let mut val = vec![0x0u8; 1 + 2 * field_sz];
let x_missing = field_sz - x.len();