diff options
author | Steven Fackler <sfackler@gmail.com> | 2018-03-11 13:29:01 -0700 |
---|---|---|
committer | Steven Fackler <sfackler@gmail.com> | 2018-03-11 13:29:01 -0700 |
commit | 40e59db37c63eab3977f6670b9e5fc23a1e2aad9 (patch) | |
tree | 5605e1c18e75839b67230610fc7582f45535fe78 /openssl/src/pkey.rs | |
parent | eb5fda588f83e74701bbcaeb646ca3800275d495 (diff) | |
download | rust-openssl-40e59db37c63eab3977f6670b9e5fc23a1e2aad9.zip |
Rename Oid to Id
Diffstat (limited to 'openssl/src/pkey.rs')
-rw-r--r-- | openssl/src/pkey.rs | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/openssl/src/pkey.rs b/openssl/src/pkey.rs index 506c6db7..66ff33d6 100644 --- a/openssl/src/pkey.rs +++ b/openssl/src/pkey.rs @@ -70,26 +70,26 @@ pub enum Public {} /// A tag type indicating that a key has private components. pub enum Private {} -/// The Oids that identify the type of a key. +/// An identifier of a kind of key. #[derive(Debug, Copy, Clone, PartialEq, Eq)] -pub struct Oid(c_int); +pub struct Id(c_int); -impl Oid { - /// Creates a `Oid` from an integer representation. - pub fn from_raw(value: c_int) -> Oid { - Oid(value) +impl Id { + /// Creates a `Id` from an integer representation. + pub fn from_raw(value: c_int) -> Id { + Id(value) } - /// Returns the integer representation of `Oid`. + /// Returns the integer representation of the `Id`. pub fn as_raw(&self) -> c_int { self.0 } - pub const RSA: Oid = Oid(ffi::EVP_PKEY_RSA); - pub const HMAC: Oid = Oid(ffi::EVP_PKEY_HMAC); - pub const DSA: Oid = Oid(ffi::EVP_PKEY_DSA); - pub const DH: Oid = Oid(ffi::EVP_PKEY_DH); - pub const EC: Oid = Oid(ffi::EVP_PKEY_EC); + pub const RSA: Id = Id(ffi::EVP_PKEY_RSA); + pub const HMAC: Id = Id(ffi::EVP_PKEY_HMAC); + pub const DSA: Id = Id(ffi::EVP_PKEY_DSA); + pub const DH: Id = Id(ffi::EVP_PKEY_DH); + pub const EC: Id = Id(ffi::EVP_PKEY_EC); } /// A trait indicating that a key has parameters. @@ -178,14 +178,14 @@ impl<T> PKeyRef<T> { } } - /// Returns the Oid that represents the type of this key. + /// Returns the `Id` that represents the type of this key. /// /// This corresponds to [`EVP_PKEY_id`]. /// /// [`EVP_PKEY_id`]: https://www.openssl.org/docs/man1.1.0/crypto/EVP_PKEY_id.html - pub fn oid(&self) -> Oid { + pub fn id(&self) -> Id { unsafe { - Oid::from_raw(ffi::EVP_PKEY_id(self.as_ptr())) + Id::from_raw(ffi::EVP_PKEY_id(self.as_ptr())) } } } @@ -564,7 +564,7 @@ mod tests { let rsa = Rsa::generate(2048).unwrap(); let pkey = PKey::from_rsa(rsa).unwrap(); pkey.rsa().unwrap(); - assert_eq!(pkey.oid(), Oid::RSA); + assert_eq!(pkey.id(), Id::RSA); assert!(pkey.dsa().is_err()); } @@ -573,7 +573,7 @@ mod tests { let dsa = Dsa::generate(2048).unwrap(); let pkey = PKey::from_dsa(dsa).unwrap(); pkey.dsa().unwrap(); - assert_eq!(pkey.oid(), Oid::DSA); + assert_eq!(pkey.id(), Id::DSA); assert!(pkey.rsa().is_err()); } @@ -583,7 +583,7 @@ mod tests { let dh = Dh::params_from_pem(dh).unwrap(); let pkey = PKey::from_dh(dh).unwrap(); pkey.dh().unwrap(); - assert_eq!(pkey.oid(), Oid::DH); + assert_eq!(pkey.id(), Id::DH); assert!(pkey.rsa().is_err()); } @@ -592,7 +592,7 @@ mod tests { let ec_key = EcKey::from_curve_name(Nid::X9_62_PRIME256V1).unwrap(); let pkey = PKey::from_ec_key(ec_key).unwrap(); pkey.ec_key().unwrap(); - assert_eq!(pkey.oid(), Oid::EC); + assert_eq!(pkey.id(), Id::EC); assert!(pkey.rsa().is_err()); } } |