1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
#[derive(Clone, Copy, Debug, PartialEq)] pub enum Attribute { /** Name of the SSL implementation in use. (Currently, only "OpenSSL" is implemented) */ Library, /** * SSL/TLS version in use. Common values are "TLSv1", "TLSv1.1" and "TLSv1.2", but an * implementation may return other strings if some other protocol is used. */ Protocol, /** Number of key bits used by the encryption algorithm. */ KeyBits, /** * A short name of the ciphersuite used, e.g. "DHE-RSA-DES-CBC3-SHA". The names are specific to * each SSL implementation. */ Cipher, /** * If SSL compression is in use, returns the name of the compression algorithm, or "on" if * compression is used but the algorithm is not known. If compression is not in use, returns * "off". */ Compression, } impl ToString for Attribute { fn to_string(&self) -> String { format!("{:?}", self).to_lowercase() } } #[doc(hidden)] impl From<&String> for Attribute { fn from(s: &String) -> Self { match s.as_str() { "library" => Self::Library, "protocol" => Self::Protocol, "key_bits" => Self::KeyBits, "cipher" => Self::Cipher, "compression" => Self::Compression, _ => unimplemented!(), } } }