Skip to content
Snippets Groups Projects
Commit 5f46dafd authored by lazarog98's avatar lazarog98
Browse files

#232 fix decrypt not forwarding sign key

parent e089640f
Branches
Tags
2 merge requests!58Onboarding screens swift ui merge dev,!35Resolve "SMIME Support"
......@@ -711,12 +711,13 @@ PkfA6mR7rtcyIbHi34tfkCv/qolV3QivMHov0IJpRyNO
let verifyCryptoObj = verify(data: outputData, email: fromAddr, isMailNew: isMailNew)
let signKey = verifyCryptoObj.signKey
let sigState = verifyCryptoObj.signatureState
let addresses = verifyCryptoObj.signedAdrs
let plainText = verifyCryptoObj.plaintext
let decryptedData = plainText!.data(using: .utf8)!
return CryptoObject(chiphertext: data, plaintext: plainText, decryptedData: decryptedData, sigState: sigState, encState: encState, signKey: fp, encType: CryptoScheme.SMIME, signedAdrs: sigState == SignatureState.ValidSignature ? addresses : [])
return CryptoObject(chiphertext: data, plaintext: plainText, decryptedData: decryptedData, sigState: sigState, encState: encState, signKey: signKey, encType: CryptoScheme.SMIME, signedAdrs: sigState == SignatureState.ValidSignature ? addresses : [])
}
func sign(plainData: Data, myEmail: String, detached: Bool = true) throws -> CryptoObject {
......@@ -811,7 +812,13 @@ PkfA6mR7rtcyIbHi34tfkCv/qolV3QivMHov0IJpRyNO
return pem
}))
return CryptoObject(chiphertext: data, plaintext: verStr!, decryptedData: nil, sigState: sigState, encState: EncryptionState.NoEncryption, signKey: nil, encType: .SMIME, signedAdrs: signedAddresses)
let signKeyFps = certsFPArr!.map( { (arg) -> String in
let (fp, _) = arg
return fp
})
// TODO: set signKey to the entire array after CryptoObject has been modified to use multiple keys
return CryptoObject(chiphertext: data, plaintext: verStr!, decryptedData: nil, sigState: sigState, encState: EncryptionState.NoEncryption, signKey: signKeyFps[0], encType: .SMIME, signedAdrs: signedAddresses)
}
func encrypt(plainData: Data, ids: [String], ownId: String, encryptForMyId: Bool = true) throws -> CryptoObject {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment