// retrieve the certs as pems for each ID (email), certsKeychain stores for each email a fingerprint of the cert of that user and under a fingerprint a cert is stored
foridinids{
ifletfp=certsKeychain[id]{
// TODO: Exception try catch
pems.append(certsKeychain[fp]!)
}
else{
// TODO: Exception
print("No cert for email ",id)
throwSMIMEError(message:"No cert for email "+id+"!",errorArray:nil,type:SMIMEError.ErrorType.encryption)
}
}
// TODO: Ask Oliver why signing is allowed only with encryptForMyID = true
// if we want to encrypt with the user's own key, retrieve the key and handle errors
ifencryptForMyId{
ifletfp=getOwnKeyFP(){
ownFp=fp
// TODO: Exception try catch
pems.append(certsKeychain[fp]!)
}
else{
// TODO: Exception
print("No cert for own key!")
throwSMIMEError(message:"Tried to encrypt email with the user's key but no cert for own key present!",errorArray:nil,type:SMIMEError.ErrorType.encryption)