@@ -38,18 +38,18 @@ typedef NS_ERROR_ENUM(PGPErrorDomain, PGPErrorCode) {
3838 PGPErrorNotFound = 11
3939};
4040
41- typedef NS_ENUM (NSInteger , PGPFormatType) {
41+ typedef NS_CLOSED_ENUM (NSInteger , PGPFormatType) {
4242 PGPFormatUnknown = 0 ,
4343 PGPFormatOld = 1 ,
4444 PGPFormatNew = 2
4545};
4646
47- typedef NS_ENUM (NSUInteger , PGPHeaderPacketTag) {
47+ typedef NS_CLOSED_ENUM (NSUInteger , PGPHeaderPacketTag) {
4848 PGPHeaderPacketTagNewFormat = 0x40 ,
4949 PGPHeaderPacketTagAllwaysSet = 0x80
5050};
5151
52- typedef NS_ENUM (UInt8, PGPPacketTag) {
52+ typedef NS_CLOSED_ENUM (UInt8, PGPPacketTag) {
5353 PGPInvalidPacketTag = 0 ,
5454 PGPPublicKeyEncryptedSessionKeyPacketTag = 1 ,
5555 PGPSignaturePacketTag = 2 ,
@@ -74,21 +74,23 @@ typedef NS_ENUM(UInt8, PGPPacketTag) {
7474 PGPExperimentalPacketTag4 = 63
7575};
7676
77- typedef NS_ENUM (UInt8, PGPUserAttributeSubpacketType) {
77+ typedef NS_CLOSED_ENUM (UInt8, PGPUserAttributeSubpacketType) {
78+ PGPUserAttributeSubpacketUnknown = 0x00 ,
7879 PGPUserAttributeSubpacketImage = 0x01 // The only currently defined subpacket type is 1, signifying an image.
7980};
8081
8182// 9.1. Public-Key Algorithms
82- typedef NS_ENUM (UInt8, PGPPublicKeyAlgorithm) {
83+ typedef NS_CLOSED_ENUM (UInt8, PGPPublicKeyAlgorithm) {
8384 PGPPublicKeyAlgorithmRSA = 1 ,
8485 PGPPublicKeyAlgorithmRSAEncryptOnly = 2 ,
8586 PGPPublicKeyAlgorithmRSASignOnly = 3 ,
8687 PGPPublicKeyAlgorithmElgamal = 16 , // Elgamal (Encrypt-Only)
8788 PGPPublicKeyAlgorithmDSA = 17 ,
88- PGPPublicKeyAlgorithmElliptic = 18 ,
89- PGPPublicKeyAlgorithmECDSA = 19 ,
89+ PGPPublicKeyAlgorithmECDH = 18 , // encrypt-only
90+ PGPPublicKeyAlgorithmECDSA = 19 , // sign-only
9091 PGPPublicKeyAlgorithmElgamalEncryptorSign = 20 , // Deprecated ?
9192 PGPPublicKeyAlgorithmDiffieHellman = 21 , // TODO: Deprecated?
93+ PGPPublicKeyAlgorithmEdDSA = 22 , // sign-only
9294 PGPPublicKeyAlgorithmPrivate1 = 100 ,
9395 PGPPublicKeyAlgorithmPrivate2 = 101 ,
9496 PGPPublicKeyAlgorithmPrivate3 = 102 ,
@@ -103,7 +105,7 @@ typedef NS_ENUM(UInt8, PGPPublicKeyAlgorithm) {
103105};
104106
105107// 9.2. Symmetric-Key Algorithms
106- typedef NS_ENUM (UInt8, PGPSymmetricAlgorithm) {
108+ typedef NS_CLOSED_ENUM (UInt8, PGPSymmetricAlgorithm) {
107109 PGPSymmetricPlaintext = 0 ,
108110 PGPSymmetricIDEA = 1 , // 8 bytes (64-bit) block size, key length: 2 bytes (16 bit)
109111 PGPSymmetricTripleDES = 2 , // 8 bytes (64-bit) block size
@@ -116,19 +118,32 @@ typedef NS_ENUM(UInt8, PGPSymmetricAlgorithm) {
116118 PGPSymmetricMax
117119};
118120
121+ // rfc4880bis 9.2. ECC Curve OID
122+ typedef NS_CLOSED_ENUM (UInt8, PGPCurve) {
123+ PGPCurveP256 = 0 ,
124+ PGPCurveP384 = 1 ,
125+ PGPCurveP521 = 2 ,
126+ PGPCurveBrainpoolP256r1 = 3 ,
127+ PGPCurveBrainpoolP512r1 = 4 ,
128+ PGPCurveEd25519 = 5 ,
129+ PGPCurve25519 = 6
130+ };
131+
119132// 9.4. Hash Algorithms
120- typedef NS_ENUM (UInt8, PGPHashAlgorithm) {
133+ typedef NS_CLOSED_ENUM (UInt8, PGPHashAlgorithm) {
121134 PGPHashUnknown = 0 ,
122135 PGPHashMD5 = 1 , // MD5 - deprecated
123136 PGPHashSHA1 = 2 , // SHA1 - required
124137 PGPHashRIPEMD160 = 3 , // RIPEMD160
125138 PGPHashSHA256 = 8 , // SHA256
126139 PGPHashSHA384 = 9 , // SHA384
127140 PGPHashSHA512 = 10 , // SHA512
128- PGPHashSHA224 = 11 // SHA224
141+ PGPHashSHA224 = 11 , // SHA224
142+ PGPHashSHA3_256 = 12 , // SHA3-256
143+ PGPHashSHA3_512 = 14 // SHA3-512
129144};
130145
131- typedef NS_ENUM (UInt8, PGPSignatureType) {
146+ typedef NS_CLOSED_ENUM (UInt8, PGPSignatureType) {
132147 PGPSignatureBinaryDocument = 0x00 ,
133148 PGPSignatureCanonicalTextDocument = 0x01 ,
134149 PGPSignatureStandalone = 0x02 ,
@@ -147,7 +162,7 @@ typedef NS_ENUM(UInt8, PGPSignatureType) {
147162 PGPSignatureUnknown = 0xFF
148163};
149164
150- typedef NS_ENUM (UInt8, PGPSignatureSubpacketType) {
165+ typedef NS_CLOSED_ENUM (UInt8, PGPSignatureSubpacketType) {
151166 PGPSignatureSubpacketTypeUnknown = 0 , // Unknown
152167 PGPSignatureSubpacketTypeSignatureCreationTime = 2 ,
153168 PGPSignatureSubpacketTypeSignatureExpirationTime = 3 ,
@@ -170,13 +185,16 @@ typedef NS_ENUM(UInt8, PGPSignatureSubpacketType) {
170185 PGPSignatureSubpacketTypeSignerUserID = 28 ,
171186 PGPSignatureSubpacketTypeReasonForRevocation = 29 ,
172187 PGPSignatureSubpacketTypeFeatures = 30 ,
173- PGPSignatureSubpacketTypeSignatureTarget = 31 , // Seems unused at all
188+ PGPSignatureSubpacketTypeSignatureTarget = 31 , // Seems unused at all, https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-rfc4880bis-10#section-5.2.3.26
174189 PGPSignatureSubpacketTypeEmbeddedSignature = 32 ,
175- PGPSignatureSubpacketTypeIssuerFingerprint = 33 // TODO: Experimental: Issuer fingerprint
190+ PGPSignatureSubpacketTypeIssuerFingerprint = 33 , // TODO: https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-rfc4880bis-10#section-5.2.3.28
191+ PGPSignatureSubpacketTypeIntendedRecipientFingerprint = 35 , // TODO: https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-rfc4880bis-10#section-5.2.3.29
192+ PGPSignatureSubpacketTypeAttestedCertifications = 37 , // TODO: https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-rfc4880bis-10#section-5.2.3.30
193+ PGPSignatureSubpacketTypeKeyBlock = 38 // TODO: https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-rfc4880bis-10#section-5.2.3.31
176194};
177195
178196// 5.2.3.21. Key Flags
179- typedef NS_ENUM (UInt8, PGPSignatureFlags) {
197+ typedef NS_CLOSED_ENUM (UInt8, PGPSignatureFlags) {
180198 PGPSignatureFlagUnknown = 0x00 ,
181199 PGPSignatureFlagAllowCertifyOtherKeys = 0x01 , // indicates that this key may be used to certify other keys
182200 PGPSignatureFlagAllowSignData = 0x02 , // indicates that this key may be used to sign data.
@@ -188,19 +206,19 @@ typedef NS_ENUM(UInt8, PGPSignatureFlags) {
188206};
189207
190208// 5.2.3.17. Key Server Preferences
191- typedef NS_ENUM (UInt8, PGPKeyServerPreferenceFlags) {
209+ typedef NS_CLOSED_ENUM (UInt8, PGPKeyServerPreferenceFlags) {
192210 PGPKeyServerPreferenceUnknown = 0x00 ,
193211 PGPKeyServerPreferenceNoModify = 0x80 // No-modify
194212};
195213
196214// 5.2.3.24. Features
197- typedef NS_ENUM (UInt8, PGPFeature) {
215+ typedef NS_CLOSED_ENUM (UInt8, PGPFeature) {
198216 PGPFeatureModificationUnknown = 0x00 ,
199217 PGPFeatureModificationDetection = 0x01 // Modification Detection (packets 18 and 19)
200218};
201219
202220// 3.7.1. String-to-Key (S2K) Specifier Types
203- typedef NS_ENUM (UInt8, PGPS2KSpecifier) {
221+ typedef NS_CLOSED_ENUM (UInt8, PGPS2KSpecifier) {
204222 PGPS2KSpecifierSimple = 0 ,
205223 PGPS2KSpecifierSalted = 1 ,
206224 PGPS2KSpecifierIteratedAndSalted = 3 ,
@@ -212,14 +230,14 @@ typedef NS_ENUM(UInt8, PGPS2KSpecifier) {
212230 PGPS2KSpecifierDivertToCard = 102
213231};
214232
215- typedef NS_ENUM (UInt8, PGPS2KUsage) {
233+ typedef NS_CLOSED_ENUM (UInt8, PGPS2KUsage) {
216234 PGPS2KUsageNonEncrypted = 0 , // no passphrase
217235 PGPS2KUsageEncryptedAndHashed = 254 ,
218236 PGPS2KUsageEncrypted = 255
219237};
220238
221239// 9.3. Compression Algorithms
222- typedef NS_ENUM (UInt8, PGPCompressionAlgorithm) {
240+ typedef NS_CLOSED_ENUM (UInt8, PGPCompressionAlgorithm) {
223241 PGPCompressionUncompressed = 0 ,
224242 PGPCompressionZIP = 1 ,
225243 PGPCompressionZLIB = 2 ,
0 commit comments