Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d25093d2 authored by Alex Klyubin's avatar Alex Klyubin Committed by Android (Google) Code Review
Browse files

Merge "Reject AlgorithmParameters of wrong type." into mnc-dev

parents 3aa1b1e5 5c38e791
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -129,6 +129,12 @@ abstract class AndroidKeyStoreAuthenticatedAESCipherSpi extends AndroidKeyStoreC
                return;
            }

            if (!"GCM".equalsIgnoreCase(params.getAlgorithm())) {
                throw new InvalidAlgorithmParameterException(
                        "Unsupported AlgorithmParameters algorithm: " + params.getAlgorithm()
                        + ". Supported: GCM");
            }

            GCMParameterSpec spec;
            try {
                spec = params.getParameterSpec(GCMParameterSpec.class);
+6 −0
Original line number Diff line number Diff line
@@ -197,6 +197,12 @@ class AndroidKeyStoreUnauthenticatedAESCipherSpi extends AndroidKeyStoreCipherSp
            return;
        }

        if (!"AES".equalsIgnoreCase(params.getAlgorithm())) {
            throw new InvalidAlgorithmParameterException(
                    "Unsupported AlgorithmParameters algorithm: " + params.getAlgorithm()
                    + ". Supported: AES");
        }

        IvParameterSpec ivSpec;
        try {
            ivSpec = params.getParameterSpec(IvParameterSpec.class);