NevisServerPinningPolicy
public enum NevisServerPinningPolicy
extension NevisServerPinningPolicy: Codable
The list of supported policies used to evaluate server trusts.
Warning
Applications are encouraged to always pin certificates in production environments.Encoding and Decoding
NevisServerPinningPolicy
conforms to Codable
in order to be easily decoded from JSON or a property list.
Because the type is defined as an enum with associated values, it must follow a specific structure that defines the policy option and its associated value(s), if any.
See NevisServerPinningPolicy.CodingKeys
for the list of available keys and NevisServerPinningPolicy.RawValues
for the list of available raw values.
The following JSON representation defines a policy that enables certificate pinning for a specific list of SPKI hashes:
{
"policy" : "pinCertificates",
"certificateSPKIHashes" : ["XXXXX", "00000"]
}
The following JSON representation defines a policy that disables certificate pinning:
{
"policy" : "disablePinning"
}
-
Certificate pinning is disabled.
Declaration
Swift
case disablePinning
-
Uses the pinned Subject Public Key Info (SPKI) to validate the server trust.
The server trust is considered valid if one of the pinned SPKI hashes match the server intermediate certificate SPKI hashes. Otherwise pinning will fail and the connection will not be established.
Declaration
Swift
case pinCertificates(hashes: [String])
-
The list of keys used for encoding and decoding a policy.
See moreDeclaration
Swift
public enum CodingKeys : String, CodingKey
-
The list of raw values that define an encoded policy.
See moreDeclaration
Swift
public enum RawValues : String, Codable
-
Creates a new instance by decoding from the given decoder.
Declaration
Swift
public init(from decoder: Decoder) throws
-
Encodes this value into the given encoder.
Declaration
Swift
public func encode(to encoder: Encoder) throws