Add more metadata to Cipher/Digest

- Ciphers are AES.
- Digests are HMAC.
This commit is contained in:
Davide De Rosa 2018-09-06 10:55:56 +02:00
parent ce6a41a218
commit 0b28eacf0d

View File

@ -40,7 +40,7 @@ import Foundation
extension SessionProxy { extension SessionProxy {
/// The available encryption algorithms. /// The available encryption algorithms.
public enum Cipher: String, Codable { public enum Cipher: String, Codable, CustomStringConvertible {
// WARNING: must match OpenSSL algorithm names // WARNING: must match OpenSSL algorithm names
@ -66,10 +66,19 @@ extension SessionProxy {
public var embedsDigest: Bool { public var embedsDigest: Bool {
return rawValue.hasSuffix("-GCM") return rawValue.hasSuffix("-GCM")
} }
public var genericName: String {
return "AES"
}
/// :nodoc:
public var description: String {
return rawValue
}
} }
/// The available message digest algorithms. /// The available message digest algorithms.
public enum Digest: String, Codable { public enum Digest: String, Codable, CustomStringConvertible {
// WARNING: must match OpenSSL algorithm names // WARNING: must match OpenSSL algorithm names
@ -87,6 +96,15 @@ extension SessionProxy {
/// SHA256 message digest. /// SHA256 message digest.
case sha512 = "SHA512" case sha512 = "SHA512"
public var genericName: String {
return "HMAC"
}
/// :nodoc:
public var description: String {
return "\(genericName)-\(rawValue)"
}
} }
/// The way to create a `SessionProxy.Configuration` object for a `SessionProxy`. /// The way to create a `SessionProxy.Configuration` object for a `SessionProxy`.