diff options
author | David Drysdale <drysdale@google.com> | 2021-12-15 07:11:46 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-12-15 07:11:46 +0000 |
commit | 6e2b1afdebf7480c4b17a13593f0d6b7bc99b4a0 (patch) | |
tree | d2daf4d3db2384616bc8aa39998d55267ac1bc9c /security/keymint/aidl/vts/functional/KeyMintTest.cpp | |
parent | 7eab7e559df9a25a2216a33f027f3e79501b825d (diff) | |
parent | 35392ef70e05fcb1d1f486889be761a832252eb4 (diff) |
Merge "KeyMint VTS: ATTEST_KEY has no other purpose" am: a67b0441fe am: 02c4ee0dca am: 35392ef70e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1844276
Change-Id: Ia77411d469b6a291ec333ea27150c5eef8eb2ac1
Diffstat (limited to 'security/keymint/aidl/vts/functional/KeyMintTest.cpp')
-rw-r--r-- | security/keymint/aidl/vts/functional/KeyMintTest.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp index 161531d8f8..217ea0e847 100644 --- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp +++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp @@ -3352,6 +3352,26 @@ TEST_P(ImportKeyTest, RsaPublicExponentMismatch) { } /* + * ImportKeyTest.RsaAttestMultiPurposeFail + * + * Verifies that importing an RSA key pair with purpose ATTEST_KEY+SIGN fails. + */ +TEST_P(ImportKeyTest, RsaAttestMultiPurposeFail) { + uint32_t key_size = 2048; + string key = rsa_2048_key; + + ASSERT_EQ(ErrorCode::INCOMPATIBLE_PURPOSE, + ImportKey(AuthorizationSetBuilder() + .Authorization(TAG_NO_AUTH_REQUIRED) + .RsaSigningKey(key_size, 65537) + .AttestKey() + .Digest(Digest::SHA_2_256) + .Padding(PaddingMode::RSA_PSS) + .SetDefaultValidity(), + KeyFormat::PKCS8, key)); +} + +/* * ImportKeyTest.EcdsaSuccess * * Verifies that importing and using an ECDSA P-256 key pair works correctly. @@ -3470,6 +3490,22 @@ TEST_P(ImportKeyTest, EcdsaCurveMismatch) { } /* + * ImportKeyTest.EcdsaAttestMultiPurposeFail + * + * Verifies that importing and using an ECDSA P-256 key pair with purpose ATTEST_KEY+SIGN fails. + */ +TEST_P(ImportKeyTest, EcdsaAttestMultiPurposeFail) { + ASSERT_EQ(ErrorCode::INCOMPATIBLE_PURPOSE, + ImportKey(AuthorizationSetBuilder() + .Authorization(TAG_NO_AUTH_REQUIRED) + .EcdsaSigningKey(EcCurve::P_256) + .AttestKey() + .Digest(Digest::SHA_2_256) + .SetDefaultValidity(), + KeyFormat::PKCS8, ec_256_key)); +} + +/* * ImportKeyTest.AesSuccess * * Verifies that importing and using an AES key works. |