Merge branch 'PEMA-158'

master
Dirk Zimmermann 2 weeks ago
commit 82f74a90ae

@ -32,6 +32,7 @@ extern NSString *const _Nonnull PEPObjCAdapterErrorDomain;
successCallback:(void (^)(PEPMessage *srcMessage,
PEPMessage *dstMessage,
PEPStringList *keyList,
PEPRating rating,
PEPDecryptFlags flags,
BOOL isFormerlyEncryptedReuploadedMessage))successCallback;

@ -8,7 +8,6 @@
/* Begin PBXBuildFile section */
43312028292553A200DFD28C /* libPEPObjCTypeUtils_iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1585EB3D2698636C00B822E1 /* libPEPObjCTypeUtils_iOS.a */; };
43312033292553EF00DFD28C /* PEPMessageASN1Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 43B0EADF274D222000F5D076 /* PEPMessageASN1Tests.m */; };
43312034292553F200DFD28C /* PEPIdentityAddressTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B11964427B50B0900FDF0B5 /* PEPIdentityAddressTests.m */; };
43312035292553F500DFD28C /* PEPIdentityComparisonTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B2F476B27BA5CAF003517EC /* PEPIdentityComparisonTest.m */; };
433120362925541400DFD28C /* libPEPObjCTypes_iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 43431E12278D782A00A1AB63 /* libPEPObjCTypes_iOS.a */; };
@ -22,11 +21,9 @@
43A6D585292CF75D004DA26B /* NSArray+PEPConvert.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5BC7CC7627A3FD190072AC5B /* NSArray+PEPConvert.h */; };
43A6D586292CF75D004DA26B /* NSArray+PEPIdentityList.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5BC7CC7027A3F9360072AC5B /* NSArray+PEPIdentityList.h */; };
43A6D587292CF75D004DA26B /* PEPIdentity+PEPConvert.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5B29DA3627A0466E00D7638E /* PEPIdentity+PEPConvert.h */; };
43A6D588292CF75D004DA26B /* PEPMessage+ASN1.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 43B0EAC2274D1EA700F5D076 /* PEPMessage+ASN1.h */; };
43A6D589292CF75D004DA26B /* PEPMessage+PEPConvert.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5B29DA2827A0439F00D7638E /* PEPMessage+PEPConvert.h */; };
43A6D58A292CF75D004DA26B /* PEPIdentity+URIAddressScheme.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5B11963927B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.h */; };
43B0EAD5274D21E100F5D076 /* libPEPObjCTypeUtils_macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1585EA7C26984C4300B822E1 /* libPEPObjCTypeUtils_macOS.a */; };
43B0EAE0274D222000F5D076 /* PEPMessageASN1Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 43B0EADF274D222000F5D076 /* PEPMessageASN1Tests.m */; };
43D97EF1278D875D005EA014 /* libPEPObjCTypes_macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 43431E10278D782A00A1AB63 /* libPEPObjCTypes_macOS.a */; };
5B11963A27B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B11963827B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.m */; };
5B11963B27B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B11963827B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.m */; };
@ -36,8 +33,6 @@
5B29DA3A27A0466E00D7638E /* PEPIdentity+PEPConvert.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B29DA3727A0466E00D7638E /* PEPIdentity+PEPConvert.m */; };
5B29DA3B27A0466E00D7638E /* PEPIdentity+PEPConvert.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B29DA3727A0466E00D7638E /* PEPIdentity+PEPConvert.m */; };
5B2F476C27BA5CAF003517EC /* PEPIdentityComparisonTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B2F476B27BA5CAF003517EC /* PEPIdentityComparisonTest.m */; };
5B5ACF9827A19B1F00B34412 /* PEPMessage+ASN1.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B5ACE1627A1925800B34412 /* PEPMessage+ASN1.m */; };
5B5ACF9927A19B2000B34412 /* PEPMessage+ASN1.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B5ACE1627A1925800B34412 /* PEPMessage+ASN1.m */; };
5B5ACF9A27A19B2100B34412 /* PEPStatusNSErrorUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B5ACE1527A1925800B34412 /* PEPStatusNSErrorUtil.m */; };
5B5ACF9B27A19B2200B34412 /* PEPStatusNSErrorUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B5ACE1527A1925800B34412 /* PEPStatusNSErrorUtil.m */; };
5BC7CC7427A3F9760072AC5B /* NSArray+PEPIdentityList.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BC7CC7327A3F9760072AC5B /* NSArray+PEPIdentityList.m */; };
@ -152,7 +147,6 @@
43A6D585292CF75D004DA26B /* NSArray+PEPConvert.h in CopyFiles */,
43A6D586292CF75D004DA26B /* NSArray+PEPIdentityList.h in CopyFiles */,
43A6D587292CF75D004DA26B /* PEPIdentity+PEPConvert.h in CopyFiles */,
43A6D588292CF75D004DA26B /* PEPMessage+ASN1.h in CopyFiles */,
43A6D589292CF75D004DA26B /* PEPMessage+PEPConvert.h in CopyFiles */,
43A6D58A292CF75D004DA26B /* PEPIdentity+URIAddressScheme.h in CopyFiles */,
43A6D582292CF752004DA26B /* module.modulemap in CopyFiles */,
@ -170,9 +164,7 @@
43312024292553A200DFD28C /* PEPObjCTypeUtilsTests_iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PEPObjCTypeUtilsTests_iOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
439CA04B29262FA7003FAC02 /* PerMachineDirectory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PerMachineDirectory.m; sourceTree = "<group>"; };
43A6D581292CF6DC004DA26B /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
43B0EAC2274D1EA700F5D076 /* PEPMessage+ASN1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PEPMessage+ASN1.h"; sourceTree = "<group>"; };
43B0EAD1274D21E100F5D076 /* PEPObjCTypeUtilsTests_macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PEPObjCTypeUtilsTests_macOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
43B0EADF274D222000F5D076 /* PEPMessageASN1Tests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PEPMessageASN1Tests.m; sourceTree = "<group>"; };
4E51C1F926CD12EE007A2164 /* libPEPObjCTypes_macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libPEPObjCTypes_macOS.a; sourceTree = BUILT_PRODUCTS_DIR; };
5B11963827B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PEPIdentity+URIAddressScheme.m"; sourceTree = "<group>"; };
5B11963927B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PEPIdentity+URIAddressScheme.h"; sourceTree = "<group>"; };
@ -183,7 +175,6 @@
5B29DA3727A0466E00D7638E /* PEPIdentity+PEPConvert.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "PEPIdentity+PEPConvert.m"; sourceTree = "<group>"; };
5B2F476B27BA5CAF003517EC /* PEPIdentityComparisonTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPIdentityComparisonTest.m; sourceTree = "<group>"; };
5B5ACE1527A1925800B34412 /* PEPStatusNSErrorUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPStatusNSErrorUtil.m; sourceTree = "<group>"; };
5B5ACE1627A1925800B34412 /* PEPMessage+ASN1.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "PEPMessage+ASN1.m"; sourceTree = "<group>"; };
5BAAF80127A936430037C55E /* PEPStatusNSErrorUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PEPStatusNSErrorUtil.h; sourceTree = "<group>"; };
5BC7CC7027A3F9360072AC5B /* NSArray+PEPIdentityList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSArray+PEPIdentityList.h"; sourceTree = "<group>"; };
5BC7CC7327A3F9760072AC5B /* NSArray+PEPIdentityList.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSArray+PEPIdentityList.m"; sourceTree = "<group>"; };
@ -271,7 +262,6 @@
5BC7CC7627A3FD190072AC5B /* NSArray+PEPConvert.h */,
5BC7CC7027A3F9360072AC5B /* NSArray+PEPIdentityList.h */,
5B29DA3627A0466E00D7638E /* PEPIdentity+PEPConvert.h */,
43B0EAC2274D1EA700F5D076 /* PEPMessage+ASN1.h */,
5B29DA2827A0439F00D7638E /* PEPMessage+PEPConvert.h */,
5B11963927B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.h */,
);
@ -319,7 +309,6 @@
isa = PBXGroup;
children = (
439CA04B29262FA7003FAC02 /* PerMachineDirectory.m */,
43B0EADF274D222000F5D076 /* PEPMessageASN1Tests.m */,
5B11964427B50B0900FDF0B5 /* PEPIdentityAddressTests.m */,
5B2F476B27BA5CAF003517EC /* PEPIdentityComparisonTest.m */,
);
@ -333,7 +322,6 @@
5BC7CC7727A3FD190072AC5B /* NSArray+PEPConvert.m */,
5BC7CC7327A3F9760072AC5B /* NSArray+PEPIdentityList.m */,
5B29DA3727A0466E00D7638E /* PEPIdentity+PEPConvert.m */,
5B5ACE1627A1925800B34412 /* PEPMessage+ASN1.m */,
5B29DA2927A0439F00D7638E /* PEPMessage+PEPConvert.m */,
5B5ACE1527A1925800B34412 /* PEPStatusNSErrorUtil.m */,
);
@ -587,7 +575,6 @@
files = (
5B29DA2C27A0439F00D7638E /* PEPMessage+PEPConvert.m in Sources */,
5BC7CC7427A3F9760072AC5B /* NSArray+PEPIdentityList.m in Sources */,
5B5ACF9827A19B1F00B34412 /* PEPMessage+ASN1.m in Sources */,
5BC7CC7A27A3FD190072AC5B /* NSArray+PEPConvert.m in Sources */,
5B11963A27B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.m in Sources */,
5B29DA3A27A0466E00D7638E /* PEPIdentity+PEPConvert.m in Sources */,
@ -601,7 +588,6 @@
files = (
5B29DA2D27A0439F00D7638E /* PEPMessage+PEPConvert.m in Sources */,
5BC7CC7527A3F9760072AC5B /* NSArray+PEPIdentityList.m in Sources */,
5B5ACF9927A19B2000B34412 /* PEPMessage+ASN1.m in Sources */,
5BC7CC7B27A3FD190072AC5B /* NSArray+PEPConvert.m in Sources */,
5B11963B27B41C3000FDF0B5 /* PEPIdentity+URIAddressScheme.m in Sources */,
5B29DA3B27A0466E00D7638E /* PEPIdentity+PEPConvert.m in Sources */,
@ -615,7 +601,6 @@
files = (
43312034292553F200DFD28C /* PEPIdentityAddressTests.m in Sources */,
439CA04D29262FA7003FAC02 /* PerMachineDirectory.m in Sources */,
43312033292553EF00DFD28C /* PEPMessageASN1Tests.m in Sources */,
43312035292553F500DFD28C /* PEPIdentityComparisonTest.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -627,7 +612,6 @@
5B2F476C27BA5CAF003517EC /* PEPIdentityComparisonTest.m in Sources */,
439CA04C29262FA7003FAC02 /* PerMachineDirectory.m in Sources */,
5B11964527B50B0A00FDF0B5 /* PEPIdentityAddressTests.m in Sources */,
43B0EAE0274D222000F5D076 /* PEPMessageASN1Tests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

@ -112,8 +112,6 @@
msg->attachments = [self.attachments toBloblist];
}
msg->rating = (PEP_rating) self.rating;
return msg;
}
@ -191,8 +189,6 @@
if (message->attachments && message->attachments->value) {
pEpMessage.attachments = [NSArray fromBloblist:message->attachments];
}
pEpMessage.rating = (PEPRating) message->rating;
}
+ (void)removeEmptyRecipientsFromPEPMessage:(PEPMessage *)pEpMessage
@ -238,7 +234,6 @@
pEpMessage.keywords = nil;
pEpMessage.receivedBy = nil;
pEpMessage.direction = (PEPMsgDirection) PEP_dir_incoming; // basically, 0
pEpMessage.rating = PEPRatingUndefined;
}
@end

@ -26,6 +26,46 @@ typedef NS_CLOSED_ENUM(NSUInteger, PEPTransportID) {
PEPTransportIDTransportCC = 0xfe
};
typedef NS_CLOSED_ENUM(int, PEPSyncHandshakeResult) {
PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL
PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED
PEPSyncHandshakeResultRejected = 1, // SYNC_HANDSHAKE_REJECTED
};
typedef NS_CLOSED_ENUM(int, PEPSyncHandshakeSignal) {
PEPSyncHandshakeSignalUndefined = 0, // SYNC_NOTIFY_UNDEFINED
PEPSyncHandshakeSignalInitAddOurDevice = 1, // SYNC_NOTIFY_INIT_ADD_OUR_DEVICE
PEPSyncHandshakeSignalInitAddOtherDevice = 2, // SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE
PEPSyncHandshakeSignalInitFormGroup = 3, // SYNC_NOTIFY_INIT_FORM_GROUP
PEPSyncHandshakeSignalTimeout = 5, // SYNC_NOTIFY_TIMEOUT
PEPSyncHandshakeSignalAcceptedDeviceAdded = 6, // SYNC_NOTIFY_ACCEPTED_DEVICE_ADDED
PEPSyncHandshakeSignalAcceptedGroupCreated = 7, // SYNC_NOTIFY_ACCEPTED_GROUP_CREATED
PEPSyncHandshakeSignalAcceptedDeviceAccepted = 8, // SYNC_NOTIFY_ACCEPTED_DEVICE_ACCEPTED
PEPSyncHandshakeSignalOutgoingRatingChange = 64, // SYNC_NOTIFY_OUTGOING_RATING_CHANGE
PEPSyncHandshakeSignalStart = 126, // SYNC_NOTIFY_START
PEPSyncHandshakeSignalStop = 127, // SYNC_NOTIFY_STOP
PEPSyncHandshakeSignalPassphraseRequired = 128, // SYNC_PASSPHRASE_REQUIRED
PEPSyncHandshakeSignalSole = 254, // SYNC_NOTIFY_SOLE
PEPSyncHandshakeSignalInGroup = 255, // SYNC_NOTIFY_IN_GROUP
};
typedef NS_CLOSED_ENUM(int, PEPContentDisposition) {
PEPContentDispositionAttachment = 0, // PEP_CONTENT_DISP_ATTACHMENT
PEPContentDispositionInline = 1, // PEP_CONTENT_DISP_INLINE
PEPContentDispositionOther = -1, // PEP_CONTENT_DISP_OTHER
};
typedef NS_CLOSED_ENUM(int, PEPMsgDirection) {
PEPMsgDirectionIncoming = 0, // PEP_dir_incoming
PEPMsgDirectionOutgoing, // PEP_dir_outgoing
};
typedef NS_CLOSED_ENUM(int, PEPTextFormat) {
PEPTextFormatPlain = 0, // PEP_text_format_plain
PEPTextFormatHtml, // PEP_text_format_html
PEPTextFormatOther = 0xff, // PEP_text_format_other
};
typedef NS_CLOSED_ENUM(int, PEPDecryptFlags) {
PEPDecryptFlagsNone = 0x0, // not actually defined in the engine
PEPDecryptFlagsOwnPrivateKey = 0x1, // PEP_decrypt_flag_own_private_key
@ -36,14 +76,11 @@ typedef NS_CLOSED_ENUM(int, PEPDecryptFlags) {
PEPDecryptFlagsDontTriggerSync = 0x200, // PEP_decrypt_flag_dont_trigger_sync
};
typedef NS_CLOSED_ENUM(int, PEPEncFormat) {
PEPEncFormatNone = 0, // PEP_enc_none
PEPEncFormatPieces, // PEP_enc_pieces, PEP_enc_inline
PEPEncFormatSMIME, // PEP_enc_S_MIME
PEPEncFormatPGPMIME, // PEP_enc_PGP_MIME
PEPEncFormatPEP, // PEP_enc_PEP
PEPEncFormatMediaKey = PEPEncFormatPEP, // media_key_enc_format
PEPEncFormatPGPMIMEOutlook1 // PEP_enc_PGP_MIME_Outlook1
typedef NS_CLOSED_ENUM(int, PEPColor) {
PEPColorNoColor = 0, // PEP_color_no_color
PEPColorYellow, // PEP_color_yellow
PEPColorGreen, // PEP_color_green
PEPColorRed = -1, // PEP_color_red
};
typedef NS_CLOSED_ENUM(int, PEPRating) {
@ -51,35 +88,123 @@ typedef NS_CLOSED_ENUM(int, PEPRating) {
PEPRatingCannotDecrypt = 1, // PEP_rating_cannot_decrypt
PEPRatingHaveNoKey = 2, // PEP_rating_have_no_key
PEPRatingUnencrypted = 3, // PEP_rating_unencrypted
PEPRatingUnreliable = 4, // PEP_rating_unreliable
PEPRatingMediaKeyProtected = 5, // PEP_rating_media_key_protected
PEPRatingUnreliable = 5, // PEP_rating_unreliable
PEPRatingB0rken = -2, // PEP_rating_b0rken
PEPRatingReliable = 6, // PEP_rating_reliable
// Keep the rating definition for the app, even though media keys
// are not actively used.
// Engine Release_2.1.64, media_key.c:
// `const PEP_rating media_key_message_rating = PEP_rating_unreliable`
PEPRatingMediaKeyProtected = 6,
PEPRatingTrusted = 7, // PEP_rating_trusted
PEPRatingTrustedAndAnonymized = 8, // PEP_rating_trusted_and_anonymized
PEPRatingFullyAnonymous = 9, // PEP_rating_fully_anonymous
PEPRatingMistrust = -1, // PEP_rating_mistrust
PEPRatingB0rken = -2, // PEP_rating_b0rken
PEPRatingUnderAttack = -3 // PEP_rating_under_attack
PEPRatingUnderAttack = -3, // PEP_rating_under_attack
};
typedef NS_CLOSED_ENUM(int, PEPStatus) {
PEPStatusOK = 0, // PEP_STATUS_OK
typedef NS_CLOSED_ENUM(int, PEPMessageWrapType) {
PEPMessageWrapTypeUnwrapped, // PEP_message_unwrapped
PEPMessageWrapTypeDefault, // PEP_message_default
PEPMessageWrapTypeTransport, // PEP_message_transport
PEPMessageWrapTypeKeyReset, // PEP_message_key_reset
};
PEPStatusInitCannotLoadGPME = 0x0110, // PEP_INIT_CANNOT_LOAD_GPGME
PEPStatusInitGPGMEInitFailed = 0x0111, // PEP_INIT_GPGME_INIT_FAILED
PEPStatusInitNoGPGHome = 0x0112, // PEP_INIT_NO_GPG_HOME
PEPStatusInitNETPGPInitFailed = 0x0113, // PEP_INIT_NETPGP_INIT_FAILED
PEPStatusInitCannotDetermineGPGVersion = 0x0114, // PEP_INIT_CANNOT_DETERMINE_GPG_VERSION
PEPStatusInitUnsupportedGPGVersion = 0x0115, // PEP_INIT_UNSUPPORTED_GPG_VERSION
PEPStatusInitCannotConfigGPGAgent = 0x0116, // PEP_INIT_CANNOT_CONFIG_GPG_AGENT
typedef NS_CLOSED_ENUM(int, PEPEncryptFlags) {
PEPEncryptFlagsDefault = 0x0, // PEP_encrypt_flag_default
PEPEncryptFlagsForceEncryption = 0x1, // PEP_encrypt_flag_force_encryption
PEPEncryptFlagsForceUnsigned = 0x2, // PEP_encrypt_flag_force_unsigned
PEPEncryptFlagsForceNoAttachedKey = 0x4, // PEP_encrypt_flag_force_no_attached_key
PEPEncryptFlagsInnerMessage = 0x8, // PEP_encrypt_flag_inner_message
PEPEncryptFlagsForceVersion1 = 0x10, // PEP_encrypt_flag_force_version_1
PEPEncryptFlagsKeyResetOnly = 0x20, // PEP_encrypt_flag_key_reset_only
PEPEncryptReencrypt = 0x40, // PEP_encrypt_reencrypt
};
typedef NS_CLOSED_ENUM(int, PEPIdentityFlags) {
PEPIdentityFlagsNotForSync = 0x0001, // PEP_idf_not_for_sync
PEPIdentityFlagsList = 0x0002, // PEP_idf_list
PEPIdentityFlagsDeviceGroup = 0x0100, // PEP_idf_devicegroup
};
typedef NS_CLOSED_ENUM(int, PEPCommType) {
PEPCommTypeUnknown = 0, // PEP_ct_unknown
PEPCommTypeNoEncryption = 0x01, // PEP_ct_no_encryption
PEPCommTypeNoEncryptedChannel = 0x02, // PEP_ct_no_encrypted_channel
PEPCommTypeKeyNotFound = 0x03, // PEP_ct_key_not_found
PEPCommTypeKeyExpired = 0x04, // PEP_ct_key_expired
PEPCommTypeKeyRevoked = 0x05, // PEP_ct_key_revoked
PEPCommTypeKeyB0rken = 0x06, // PEP_ct_key_b0rken
PEPCommTypeKeyExpiredButConfirmed = 0x07, // PEP_ct_key_expired_but_confirmed
PEPCommTypeMyKeyNotIncluded = 0x09, // PEP_ct_my_key_not_included
PEPCommTypeSecurityByObscurity = 0x0a, // PEP_ct_security_by_obscurity
PEPCommTypeB0rkenCrypto = 0x0b, // PEP_ct_b0rken_crypto
PEPCommTypeKeyTooShort = 0x0c, // PEP_ct_key_too_short
PEPCommTypeCompromised = 0x0e, // PEP_ct_compromised
PEPCommTypeCompromized = 0x0e, // PEP_ct_compromized
PEPCommTypeMistrusted = 0x0f, // PEP_ct_mistrusted
PEPCommTypeUnconfirmedEncryption = 0x10, // PEP_ct_unconfirmed_encryption
PEPCommTypeOpenPGPWeakUnconfirmed = 0x11, // PEP_ct_OpenPGP_weak_unconfirmed
PEPCommTypeToBeChecked = 0x20, // PEP_ct_to_be_checked
PEPCommTypeSmimeUnconfirmed = 0x21, // PEP_ct_SMIME_unconfirmed
PEPCommTypeCmsUnconfirmed = 0x22, // PEP_ct_CMS_unconfirmed
PEPCommTypeStrongButUnconfirmed = 0x30, // PEP_ct_strong_but_unconfirmed
PEPCommTypeOpenPGPUnconfirmed = 0x38, // PEP_ct_OpenPGP_unconfirmed
PEPCommTypeOtrUnconfirmed = 0x3a, // PEP_ct_OTR_unconfirmed
PEPCommTypeUnconfirmedEncAnon = 0x40, // PEP_ct_unconfirmed_enc_anon
PEPCommTypePEPUnconfirmed = 0x7f, // PEP_ct_pEp_unconfirmed
PEPCommTypeConfirmed = 0x80, // PEP_ct_confirmed
PEPCommTypeConfirmedEncryption = 0x90, // PEP_ct_confirmed_encryption
PEPCommTypeOpenPGPWeak = 0x91, // PEP_ct_OpenPGP_weak
PEPCommTypeToBeCheckedConfirmed = 0xa0, // PEP_ct_to_be_checked_confirmed
PEPCommTypeSmime = 0xa1, // PEP_ct_SMIME
PEPCommTypeCms = 0xa2, // PEP_ct_CMS
PEPCommTypeStrongEncryption = 0xb0, // PEP_ct_strong_encryption
PEPCommTypeOpenPGP = 0xb8, // PEP_ct_OpenPGP
PEPCommTypeOtr = 0xba, // PEP_ct_OTR
PEPCommTypeConfirmedEncAnon = 0xc0, // PEP_ct_confirmed_enc_anon
PEPCommTypePEP = 0xff, // PEP_ct_pEp
};
typedef NS_CLOSED_ENUM(int, PEPCipherSuite) {
PEPCipherSuiteDefault = 0, // PEP_CIPHER_SUITE_DEFAULT
PEPCipherSuiteCv25519 = 1, // PEP_CIPHER_SUITE_CV25519
PEPCipherSuiteP256 = 2, // PEP_CIPHER_SUITE_P256
PEPCipherSuiteP384 = 3, // PEP_CIPHER_SUITE_P384
PEPCipherSuiteP521 = 4, // PEP_CIPHER_SUITE_P521
PEPCipherSuiteRsa2k = 5, // PEP_CIPHER_SUITE_RSA2K
PEPCipherSuiteRsa3k = 6, // PEP_CIPHER_SUITE_RSA3K
PEPCipherSuiteRsa4k = 7, // PEP_CIPHER_SUITE_RSA4K
PEPCipherSuiteRsa8k = 8, // PEP_CIPHER_SUITE_RSA8K
};
typedef NS_CLOSED_ENUM(int, PEPEncFormat) {
PEPEncFormatNone = 0, // PEP_enc_none
PEPEncFormatPieces = 1, // PEP_enc_pieces
PEPEncFormatInline = 1, // PEP_enc_inline
PEPEncFormatSMime, // PEP_enc_S_MIME
PEPEncFormatPGPMime, // PEP_enc_PGP_MIME
PEPEncFormatPEP, // PEP_enc_PEP
PEPEncFormatPGPMimeOutlook1, // PEP_enc_PGP_MIME_Outlook1
PEPEncFormatInlineEA, // PEP_enc_inline_EA
PEPEncFormatAuto = 255, // PEP_enc_auto
};
typedef NS_CLOSED_ENUM(int, PEPStatus) {
PEPStatusOK = 0, // PEP_STATUS_OK
PEPStatusInitCannotLoadCryptoLib = 0x0110, // PEP_INIT_CANNOT_LOAD_CRYPTO_LIB
PEPStatusInitCryptoLibInitFailed = 0x0111, // PEP_INIT_CRYPTO_LIB_INIT_FAILED
PEPStatusInitNoCryptoHome = 0x0112, // PEP_INIT_NO_CRYPTO_HOME
PEPStatusInitCannotDetermineCryptoVersion = 0x0114, // PEP_INIT_CANNOT_DETERMINE_CRYPTO_VERSION
PEPStatusInitUnsupportedCryptoVersion = 0x0115, // PEP_INIT_UNSUPPORTED_CRYPTO_VERSION
PEPStatusInitCannotConfigCryptoAgent = 0x0116, // PEP_INIT_CANNOT_CONFIG_CRYPTO_AGENT
PEPStatusInitSqlite3WithoutMutex = 0x0120, // PEP_INIT_SQLITE3_WITHOUT_MUTEX
PEPStatusInitCannotOpenDB = 0x0121, // PEP_INIT_CANNOT_OPEN_DB
PEPStatusInitCannotOpenSystemDB = 0x0122, // PEP_INIT_CANNOT_OPEN_SYSTEM_DB
PEPStatusInitDbDowngradeViolation = 0x0123, // PEP_INIT_DB_DOWNGRADE_VIOLATION
PEPStatusInitDBDowngradeViolation = 0x0123, // PEP_INIT_DB_DOWNGRADE_VIOLATION
PEPStatusUnknownDBError = 0x01ff, // PEP_UNKNOWN_DB_ERROR
PEPStatusKeyNotFound = 0x0201, // PEP_KEY_NOT_FOUND
PEPStatusKeyHasAmbigName = 0x0202, // PEP_KEY_HAS_AMBIG_NAME
PEPStatusGetKeyFailed = 0x0203, // PEP_GET_KEY_FAILED
@ -89,12 +214,10 @@ typedef NS_CLOSED_ENUM(int, PEPStatus) {
PEPStatusMalformedKeyResetMsg = 0x0210, // PEP_MALFORMED_KEY_RESET_MSG
PEPStatusKeyNotReset = 0x0211, // PEP_KEY_NOT_RESET
PEPStatusCannotDeleteKey = 0x0212, // PEP_CANNOT_DELETE_KEY
PEPStatusKeyImported = 0x0220, // PEP_KEY_IMPORTED
PEPStatusNoKeyImported = 0x0221, // PEP_NO_KEY_IMPORTED
PEPStatusKeyImportStatusUnknown = 0x0222, // PEP_KEY_IMPORT_STATUS_UNKNOWN
PEPStatusSomeKeysImported = 0x0223, // PEP_SOME_KEYS_IMPORTED
PEPStatusCannotFindIdentity = 0x0301, // PEP_CANNOT_FIND_IDENTITY
PEPStatusCannotSetPerson = 0x0381, // PEP_CANNOT_SET_PERSON
PEPStatusCannotSetPGPKeyPair = 0x0382, // PEP_CANNOT_SET_PGP_KEYPAIR
@ -103,10 +226,8 @@ typedef NS_CLOSED_ENUM(int, PEPStatus) {
PEPStatusKeyBlacklisted = 0x0385, // PEP_KEY_BLACKLISTED
PEPStatusCannotFindPerson = 0x0386, // PEP_CANNOT_FIND_PERSON
PEPStatusCannotSetPEPVersion = 0X0387, // PEP_CANNOT_SET_PEP_VERSION
PEPStatusCannotFindAlias = 0x0391, // PEP_CANNOT_FIND_ALIAS
PEPStatusCannotSetAlias = 0x0392, // PEP_CANNOT_SET_ALIAS
PEPStatusUnencrypted = 0x0400, // PEP_UNENCRYPTED
PEPStatusVerified = 0x0401, // PEP_VERIFIED
PEPStatusDecrypted = 0x0402, // PEP_DECRYPTED
@ -119,20 +240,15 @@ typedef NS_CLOSED_ENUM(int, PEPStatus) {
PEPStatusCannotReencrypt = 0x0409, // PEP_CANNOT_REENCRYPT
PEPStatusVerifySignerKeyRevoked = 0x040a, // PEP_VERIFY_SIGNER_KEY_REVOKED
PEPStatusCannotDecryptUnknown = 0x04ff, // PEP_CANNOT_DECRYPT_UNKNOWN
PEPStatusTrustwordNotFound = 0x0501, // PEP_TRUSTWORD_NOT_FOUND
PEPStatusTrustwordsFPRWrongLength = 0x0502, // PEP_TRUSTWORDS_FPR_WRONG_LENGTH
PEPStatusTrustwordsDuplicateFPR = 0x0503, // PEP_TRUSTWORDS_DUPLICATE_FPR
PEPStatusCannotCreateKey = 0x0601, // PEP_CANNOT_CREATE_KEY
PEPStatusCannotSendKey = 0x0602, // PEP_CANNOT_SEND_KEY
PEPStatusPhraseNotFound = 0x0701, // PEP_PHRASE_NOT_FOUND
PEPStatusSendFunctionNotRegistered = 0x0801, // PEP_SEND_FUNCTION_NOT_REGISTERED
PEPStatusConstraintsViolated = 0x0802, // PEP_CONTRAINTS_VIOLATED
PEPStatusCannotEncode = 0x0803, // PEP_CANNOT_ENCODE
PEPStatusSyncNoNotifyCallback = 0x0901, // PEP_SYNC_NO_NOTIFY_CALLBACK
PEPStatusSyncIllegalMessage = 0x0902, // PEP_SYNC_ILLEGAL_MESSAGE
PEPStatusSyncNoInjectCallback = 0x0903, // PEP_SYNC_NO_INJECT_CALLBACK
@ -140,9 +256,7 @@ typedef NS_CLOSED_ENUM(int, PEPStatus) {
PEPStatusSyncCannotEncrypt = 0x0905, // PEP_SYNC_CANNOT_ENCRYPT
PEPStatusSyncNoMessageSendCallback = 0x0906, // PEP_SYNC_NO_MESSAGE_SEND_CALLBACK
PEPStatusSyncCannotStart = 0x0907, // PEP_SYNC_CANNOT_START
PEPStatusCannotIncreaseSequence = 0x0971, // PEP_CANNOT_INCREASE_SEQUENCE
PEPStatusStatemachineError = 0x0980, // PEP_STATEMACHINE_ERROR
PEPStatusNoTrust = 0x0981, // PEP_NO_TRUST
PEPStatusStatemachineInvalidState = 0x0982, // PEP_STATEMACHINE_INVALID_STATE
@ -151,130 +265,21 @@ typedef NS_CLOSED_ENUM(int, PEPStatus) {
PEPStatusStatemachineInvalidAction = 0x0985, // PEP_STATEMACHINE_INVALID_ACTION
PEPStatusStatemachineInhibitedEvent = 0x0986, // PEP_STATEMACHINE_INHIBITED_EVENT
PEPStatusStatemachineCannotSend = 0x0987, // PEP_STATEMACHINE_CANNOT_SEND
PEPStatusPassphraseRequired = 0x0a00, // PEP_PASSPHRASE_REQUIRED
PEPStatusWrongPassphrase = 0x0a01, // PEP_WRONG_PASSPHRASE
PEPStatusPassphraseForNewKeysRequired = 0x0a02, // PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED
PEPStatusDistributionIllegalMessage = 0x1002, // PEP_DISTRIBUTION_ILLEGAL_MESSAGE,
PEPStatusDistributionIllegalMessage = 0x1002, // PEP_DISTRIBUTION_ILLEGAL_MESSAGE
PEPStatusCommitFailed = 0xff01, // PEP_COMMIT_FAILED
PEPStatusMessageConsume = 0xff02, // PEP_MESSAGE_CONSUME
PEPStatusMessageIgnore = 0xff03, // PEP_MESSAGE_IGNORE
PEPStatusCannotConfig = 0xff04, // PEP_CANNOT_CONFIG
PEPStatusRecordNotFound = -6, // PEP_RECORD_NOT_FOUND
PEPStatusCannotCreateTempFile = -5, // PEP_CANNOT_CREATE_TEMP_FILE
PEPStatusIllegalValue = -4, // PEP_ILLEGAL_VALUE
PEPStatusBufferTooSmall = -3, // PEP_BUFFER_TOO_SMALL
PEPStatusOutOfMemory = -2, // PEP_OUT_OF_MEMORY
PEPStatusUnknownError = -1, // PEP_UNKNOWN_ERROR
PEPStatusVersionMismatch = -7, // PEP_VERSION_MISMATCH
};
typedef NS_CLOSED_ENUM(int, PEPIdentityFlags) {
PEPIdentityFlagsNotForSync = 0x0001, // PEP_idf_not_for_sync
PEPIdentityFlagsList = 0x0002, // PEP_idf_list = 0x0002
PEPIdentityFlagsDeviceGroup = 0x0100 // PEP_idf_devicegroup
};
typedef NS_CLOSED_ENUM(int, PEPSyncHandshakeSignal) {
PEPSyncHandshakeSignalUndefined = 0, // SYNC_NOTIFY_UNDEFINED
PEPSyncHandshakeSignalInitAddOurDevice = 1, // SYNC_NOTIFY_INIT_ADD_OUR_DEVICE
PEPSyncHandshakeSignalInitAddOtherDevice = 2, // SYNC_NOTIFY_INIT_ADD_OTHER_DEVICE
PEPSyncHandshakeSignalInitFormGroup = 3, // SYNC_NOTIFY_INIT_FORM_GROUP
PEPSyncHandshakeSignalTimeout = 5, // SYNC_NOTIFY_TIMEOUT
PEPSyncHandshakeSignalAcceptedDeviceAdded = 6, // SYNC_NOTIFY_ACCEPTED_DEVICE_ADDED
PEPSyncHandshakeSignalAcceptedGroupCreated = 7, // SYNC_NOTIFY_ACCEPTED_GROUP_CREATED
PEPSyncHandshakeSignalAcceptedDeviceAccepted = 8, // SYNC_NOTIFY_ACCEPTED_DEVICE_ACCEPTED
PEPSyncHandshakeSignalOutgoingRatingChange = 64, // SYNC_NOTIFY_OUTGOING_RATING_CHANGE
PEPSyncHandshakeSignalStart = 126, // SYNC_NOTIFY_START
PEPSyncHandshakeSignalStop = 127, // SYNC_NOTIFY_STOP
PEPSyncHandshakeSignalPassphraseRequired = 128, // SYNC_PASSPHRASE_REQUIRED
PEPSyncHandshakeSignalSole = 254, // SYNC_NOTIFY_SOLE
PEPSyncHandshakeSignalInGroup = 255 // SYNC_NOTIFY_IN_GROUP
};
typedef NS_CLOSED_ENUM(int, PEPSyncHandshakeResult) {
PEPSyncHandshakeResultCancel = -1, // SYNC_HANDSHAKE_CANCEL
PEPSyncHandshakeResultAccepted = 0, // SYNC_HANDSHAKE_ACCEPTED
PEPSyncHandshakeResultRejected = 1 // SYNC_HANDSHAKE_REJECTED
};
typedef NS_CLOSED_ENUM(int, PEPCommType) {
PEPCommTypeUnknown = 0, // PEP_ct_unknown
PEPCommTypeNoEncryption = 0x01, // PEP_ct_no_encryption
PEPCommTypeNoEncrypted_channel = 0x02, // PEP_ct_no_encrypted_channel
PEPCommTypeKeyNotFound = 0x03, // PEP_ct_key_not_found
PEPCommTypeKeyExpired = 0x04, // PEP_ct_key_expired
PEPCommTypeKeyRevoked = 0x05, // PEP_ct_key_revoked
PEPCommTypeKeyB0rken = 0x06, // PEP_ct_key_b0rken
PEPCommTypeKeyExpiredButConfirmed = 0x07, // PEP_ct_key_expired_but_confirmed renewal.
PEPCommTypeMyKeyNotIncluded = 0x09, // PEP_ct_my_key_not_included
PEPCommTypeSecurityByObscurity = 0x0a, // PEP_ct_security_by_obscurity
PEPCommTypeB0rkenCrypto = 0x0b, // PEP_ct_b0rken_crypto
PEPCommTypeKeyTooShort = 0x0c, // PEP_ct_key_too_short
PEPCommTypeCompromised = 0x0e, // PEP_ct_compromized
PEPCommTypeMistrusted = 0x0f, // PEP_ct_mistrusted
PEPCommTypeUnconfirmedEncryption = 0x10, // PEP_ct_unconfirmed_encryption
PEPCommTypeMediaKey = PEPCommTypeUnconfirmedEncryption, // PEP_comm_type media_key_comm_type
PEPCommTypeOpenPGPWeakUnconfirmed = 0x11, // PEP_ct_OpenPGP_weak_unconfirmed
PEPCommTypeToBeChecked = 0x20, // PEP_ct_to_be_checked
PEPCommTypeSMIMEUnconfirmed = 0x21, // PEP_ct_SMIME_unconfirmed
PEPCommTypeCMSUnconfirmed = 0x22, // PEP_ct_CMS_unconfirmed
PEPCommTypeStongButUnconfirmed = 0x30, // PEP_ct_strong_but_unconfirmed
PEPCommTypeOpenPGPUnconfirmed = 0x38, // PEP_ct_OpenPGP_unconfirmed
PEPCommTypeOTRUnconfirmed = 0x3a, // PEP_ct_OTR_unconfirmed
PEPCommTypeUnconfirmedEncAnon = 0x40, // PEP_ct_unconfirmed_enc_anon
PEPCommTypePEPUnconfirmed = 0x7f, // PEP_ct_pEp_unconfirmed
PEPCommTypeConfirmed = 0x80, // PEP_ct_confirmed
PEPCommTypeConfirmedEncryption = 0x90, // PEP_ct_confirmed_encryption
PEPCommTypeOpenPGPWeak = 0x91, // PEP_ct_OpenPGP_weak
PEPCommTypeToBeCheckedConfirmed = 0xa0, // PEP_ct_to_be_checked_confirmed
PEPCommTypeSMIME = 0xa1, // PEP_ct_SMIME
PEPCommTypeCMS = 0xa2, // PEP_ct_CMS
PEPCommTypeStongEncryption = 0xb0, // PEP_ct_strong_encryption
PEPCommTypeOpenPGP = 0xb8, // PEP_ct_OpenPGP
PEPCommTypeOTR = 0xba, // PEP_ct_OTR
PEPCommTypeConfirmedEncAnon = 0xc0, // PEP_ct_confirmed_enc_anon
PEPCommTypePEP = 0xff // PEP_ct_pEp
};
typedef NS_CLOSED_ENUM(int, PEPMsgDirection) {
PEPMsgDirectionIncoming = 0, // PEP_dir_incoming
PEPMsgDirectionOutgoing // PEP_dir_outgoing
};
typedef NS_CLOSED_ENUM(int, PEPColor) {
PEPColorNoColor = 0, // PEP_color_no_color
PEPColorYellow, // PEP_color_yellow
PEPColorGreen, // PEP_color_green
PEPColorRed = -1, // PEP_color_red
};
typedef NS_CLOSED_ENUM(int, PEPContentDisposition) {
PEPContentDispositionAttachment = 0, // PEP_CONTENT_DISP_ATTACHMENT
PEPContentDispositionInline = 1, // PEP_CONTENT_DISP_INLINE
PEPContentDispositionOther = -1 // PEP_CONTENT_DISP_OTHER
};
#endif /* PEPEngineTypes_h */

@ -41,7 +41,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, nullable) NSArray<NSString *> *keywords;
@property (nonatomic, nullable) PEPIdentity *receivedBy;
@property (nonatomic) PEPMsgDirection direction;
@property (nonatomic) PEPRating rating;
/// A copy constructor.
- (instancetype)initWithMessage:(PEPMessage *)message;

@ -175,14 +175,6 @@
XCTAssertEqual(testee.direction, unarchivedTestee.direction);
}
- (void)testMessageRating
{
PEPMessage *testee = [PEPTypesTestUtil pEpMessageWithAllFieldsFilled];
PEPMessage *unarchivedTestee = [self archiveAndUnarchiveMessage:testee];
XCTAssertEqual(testee.rating, unarchivedTestee.rating);
}
- (void)testMessageEquality
{
PEPMessage *testee = [PEPTypesTestUtil pEpMessageWithAllFieldsFilled];

@ -86,8 +86,6 @@
message.receivedBy = identity;
message.direction = PEPMsgDirectionIncoming;
message.rating = PEPRatingB0rken;
return message;
}

@ -118,7 +118,6 @@ static NSArray *s_keys;
@"sentDate",
@"shortMessage",
@"to",
@"rating"
];
}
@ -156,7 +155,6 @@ static NSArray *s_keys;
self.keywords = [decoder decodeObjectOfClasses:stringArraySet forKey:@"keywords"];
self.receivedBy = [decoder decodeObjectOfClass:[PEPIdentity class] forKey:@"receivedBy"];
self.direction = [decoder decodeIntForKey:@"direction"];
self.rating = [decoder decodeIntForKey:@"rating"];
}
return self;
@ -187,7 +185,6 @@ static NSArray *s_keys;
[coder encodeObject:self.keywords forKey:@"keywords"];
[coder encodeObject:self.receivedBy forKey:@"receivedBy"];
[coder encodeInt:self.direction forKey:@"direction"];
[coder encodeInt:self.rating forKey:@"rating"];
}
+ (BOOL)supportsSecureCoding {

@ -263,8 +263,7 @@
XCTAssertTrue([session keyResetTrust:alice error:&error]);
XCTAssertNil(error);
// key_reset_trust makes the key not being elected anymore
XCTAssertEqual([self ratingForIdentity:alice session:session], PEPRatingHaveNoKey);
XCTAssertEqual([self ratingForIdentity:alice session:session], PEPRatingReliable);
}
/// This was once crashing, for historical details, see ENGINE-384.
@ -300,8 +299,7 @@
XCTAssertTrue([session keyResetTrust:alice error:&error]);
XCTAssertNil(error);
// key_reset_trust makes the key not being elected anymore
XCTAssertEqual([self ratingForIdentity:alice session:session], PEPRatingHaveNoKey);
XCTAssertEqual([self ratingForIdentity:alice session:session], PEPRatingReliable);
}
- (void)testOutgoingColors
@ -468,11 +466,11 @@
numRating = [self testOutgoingRatingForMessage:msg session:session error:&error];
XCTAssertNotNil(numRating);
XCTAssertNil(error);
XCTAssertEqual(numRating.pEpRating, PEPRatingReliable);
XCTAssertEqual(numRating.pEpRating, PEPRatingUnencrypted);
// Rating is also already reliable, since setIdentity has been called already
rating = [self ratingForIdentity:identBob session:session];
XCTAssertEqual(rating, PEPRatingReliable);
XCTAssertEqual(rating, PEPRatingHaveNoKey);
// Let' say we got that handshake, set PEP_ct_confirmed in Bob's identity
XCTAssertTrue([session trustPersonalKey:identBob error:&error]);
@ -658,15 +656,18 @@
NSArray *keys;
error = nil;
PEPRating rating = PEPRatingB0rken;
PEPMessage *decmsg = [session
decryptMessage:encMsg
flags:nil
rating:&rating
extraKeys:&keys
status:nil
error:&error];
XCTAssertNotNil(decmsg);
XCTAssertNil(error);
XCTAssertEqual(decmsg.rating, PEPRatingTrustedAndAnonymized);
XCTAssertEqual(rating, PEPRatingTrustedAndAnonymized);
// There shouldn't be any attachments
XCTAssertEqual(decmsg.attachments.count, 0);
@ -1017,16 +1018,19 @@
mail.attachments = @[attachment];
error = nil;
PEPStringList *keys;
PEPRating rating = PEPRatingB0rken;
PEPMessage *decmsg = [session
decryptMessage:mail
flags:nil
rating:&rating
extraKeys:&keys
status:nil
error:&error];
XCTAssertNotNil(decmsg);
XCTAssertNil(error);
XCTAssertEqual(decmsg.rating, PEPRatingUnencrypted);
XCTAssertEqual(rating, PEPRatingUnencrypted);
PEPAttachment *decryptedAttachment = [decmsg.attachments objectAtIndex:0];
XCTAssertEqualObjects(decryptedAttachment.mimeType, attachment.mimeType);
@ -1779,16 +1783,19 @@
XCTAssertEqualObjects(encMessage.shortMessage, @"pp");
error = nil;
PEPRating rating = PEPRatingB0rken;
PEPMessage *decMsg = [session
decryptMessage:encMessage
flags:nil
rating:&rating
extraKeys:keys
status:nil
error:&error];
XCTAssertNotNil(decMsg);
XCTAssertNil(error);
XCTAssertGreaterThanOrEqual(decMsg.rating, PEPRatingReliable);
XCTAssertGreaterThanOrEqual(rating, PEPRatingReliable);
XCTAssertEqualObjects(decMsg.shortMessage, shortMessage);
XCTAssertEqualObjects(decMsg.longMessage, longMessage);
@ -1857,11 +1864,14 @@
}
XCTAssertNotNil(encMsg);
PEPStringList *keys;
error = nil;
PEPStringList *keys;
PEPRating rating = PEPRatingB0rken;
PEPMessage *decMsg = [session
decryptMessage:encMsg
flags:nil
rating:&rating
extraKeys:&keys
status:nil
error:&error];
@ -1871,7 +1881,7 @@
if (!toSelf) {
// Only check this for outgoing mails. For drafts etc. this rating looks incorrect
// and the x-encstatus is the relevant one.
XCTAssertEqual(decMsg.rating, expectedRating);
XCTAssertEqual(rating, expectedRating);
}
NSArray * encStatusField = nil;

@ -110,10 +110,11 @@
successCallback:^(PEPMessage * srcMessage,
PEPMessage * dstMessage,
PEPStringList * keyList,
PEPRating rating,
PEPDecryptFlags flags,
BOOL isFormerlyEncryptedReuploadedMessage) {
XCTAssertNotNil(dstMessage);
XCTAssertEqual(dstMessage.rating, PEPRatingTrustedAndAnonymized);
XCTAssertEqual(rating, PEPRatingTrustedAndAnonymized);
[expectationDec fulfill];
}];
[self waitForExpectations:@[expectationDec] timeout:PEPTestInternalSyncTimeout];
@ -246,7 +247,7 @@
XCTAssertTrue([self keyResetTrust:alice error:&error]);
XCTAssertNil(error);
XCTAssertEqual([self ratingForIdentity:alice], PEPRatingHaveNoKey);
XCTAssertEqual([self ratingForIdentity:alice], PEPRatingReliable);
XCTAssertTrue([self keyMistrusted:alice error:&error]);
XCTAssertNil(error);
@ -281,10 +282,7 @@
NSError *error = nil;
NSString *log = [self getLogWithError:&error];
// Currently, `PEP_LOG_DESTINATIONS=PEP_LOG_DESTINATION_STDOUT`,
// so there can't be any log.
// Please see also https://gitea.pep.foundation/pEp.foundation/pEpEngine/issues/91
XCTAssertEqual(log.length, 0);
XCTAssertGreaterThan(log.length, 0);
XCTAssertNotNil(log);
XCTAssertNil(error);

@ -44,6 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
/** Decrypt a message */
- (PEPMessage * _Nullable)decryptMessage:(PEPMessage *)message
flags:(PEPDecryptFlags * _Nullable)flags
rating:(PEPRating * _Nullable)rating
extraKeys:(PEPStringList * _Nullable * _Nullable)extraKeys
status:(PEPStatus * _Nullable)status
error:(NSError * _Nullable * _Nullable)error;

@ -87,6 +87,7 @@ void decryptMessageFree(message *src, message *dst, stringlist_t *extraKeys)
- (PEPMessage * _Nullable)decryptMessage:(PEPMessage * _Nonnull)theMessage
flags:(PEPDecryptFlags * _Nullable)flags
rating:(PEPRating * _Nullable)rating
extraKeys:(PEPStringList * _Nullable * _Nullable)extraKeys
status:(PEPStatus * _Nullable)status
error:(NSError * _Nullable * _Nullable)error
@ -104,16 +105,15 @@ void decryptMessageFree(message *src, message *dst, stringlist_t *extraKeys)
theKeys = [*extraKeys toStringList];
}
// Note: According to the engine docs for decrypt_message_2, the destination
// message will be NULL on error, and the source message rating will be set regardless.
// Since we derive our returned messages from either the destination message or source,
// we'll have a correct rating in the returned result regardless.
__block PEPRating internalRating = PEPRatingUndefined;
PEPStatus theStatus = (PEPStatus) [self runWithPasswords:^PEP_STATUS(PEP_SESSION session) {
return decrypt_message_2(session,
src,
&dst,
&theKeys,
(PEP_decrypt_flags *) &theFlags);
return decrypt_message(session,
src,
&dst,
&theKeys,
(PEP_rating *) &internalRating,
(PEP_decrypt_flags *) &theFlags);
}];
if (status) {
@ -148,6 +148,10 @@ void decryptMessageFree(message *src, message *dst, stringlist_t *extraKeys)
decryptMessageFree(src, dst, theKeys);
if (rating) {
*rating = internalRating;
}
return dstMessage;
}

@ -40,6 +40,7 @@ static dispatch_queue_t queue;
successCallback:(void (^)(PEPMessage *srcMessage,
PEPMessage *dstMessage,
PEPStringList *keyList,
PEPRating rating,
PEPDecryptFlags flags,
BOOL isFormerlyEncryptedReuploadedMessage))successCallback
{
@ -47,22 +48,25 @@ static dispatch_queue_t queue;
PEPMessage *theMessage = [[PEPMessage alloc] initWithMessage:message];
PEPDecryptFlags theFlags = flags;
PEPRating theRating;
PEPStringList *theExtraKeys = extraKeys;
PEPStatus status;
NSError *error = nil;
PEPMessage *newMessage = [[PEPSessionProvider session] decryptMessage:theMessage
flags:&theFlags
rating:&theRating
extraKeys:&theExtraKeys
status:&status
error:&error];
if (newMessage) {
// See IOS-2414 for details
BOOL isFormerlyEncryptedReuploadedMessage = (status == PEPStatusUnencrypted) && newMessage.rating >= PEPRatingUnreliable;
BOOL isFormerlyEncryptedReuploadedMessage = (status == PEPStatusUnencrypted) && theRating >= PEPRatingUnreliable;
successCallback(theMessage,
newMessage,
theExtraKeys,
theRating,
theFlags,
isFormerlyEncryptedReuploadedMessage);
} else {

@ -172,11 +172,6 @@ static __weak PEPSync *s_pEpSync;
return nil;
}
// Register the callbacks that should be on _every_ session.
// Note that the status is ignored, since it would indicate an error
// e.g. for the case when not yet an own identity exists.
register_sync_callbacks(session, nil, s_notifyHandshake, nil);
return session;
}

Loading…
Cancel
Save