Nicer RESULT_INSECURE fallback for old API versions
This commit is contained in:
@@ -573,18 +573,11 @@ public class OpenPgpService extends Service {
|
|||||||
// case RESULT_NOT_ENCRYPTED, but a signature, fallback to deprecated signatureOnly variable
|
// case RESULT_NOT_ENCRYPTED, but a signature, fallback to deprecated signatureOnly variable
|
||||||
if (decryptionResult.getResult() == OpenPgpDecryptionResult.RESULT_NOT_ENCRYPTED
|
if (decryptionResult.getResult() == OpenPgpDecryptionResult.RESULT_NOT_ENCRYPTED
|
||||||
&& signatureResult.getResult() != OpenPgpSignatureResult.RESULT_NO_SIGNATURE) {
|
&& signatureResult.getResult() != OpenPgpSignatureResult.RESULT_NO_SIGNATURE) {
|
||||||
// noinspection deprecation, TODO
|
// noinspection deprecation
|
||||||
signatureResult.setSignatureOnly(true);
|
signatureResult.setSignatureOnly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// case RESULT_INSECURE, fallback to an error
|
// case RESULT_INSECURE, simply accept as a fallback like in previous API versions
|
||||||
if (decryptionResult.getResult() == OpenPgpDecryptionResult.RESULT_INSECURE) {
|
|
||||||
Intent resultError = new Intent();
|
|
||||||
resultError.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR,
|
|
||||||
"Insecure encryption: An outdated algorithm has been used!"));
|
|
||||||
resultError.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR);
|
|
||||||
return resultError;
|
|
||||||
}
|
|
||||||
|
|
||||||
// case RESULT_ENCRYPTED
|
// case RESULT_ENCRYPTED
|
||||||
// nothing to do!
|
// nothing to do!
|
||||||
|
|||||||
Reference in New Issue
Block a user