|
|
@@ -135,6 +135,16 @@ static const uint8_t kFIPSKey[] = |
|
|
|
"\xb3\xf5\x9a\x6c\x3d\x5a\x72\xb1\x2d\xfe\xac\x09\x4f\xdd\xe5\x44\xd1\x4e" |
|
|
|
"\xf8\x59\x85\x3a\x65\xe2\xcd\xbc\x27\x1d\x9b\x48\x9f\xb9"; |
|
|
|
|
|
|
|
static const uint8_t kFIPSPublicKey[] = |
|
|
|
"\x30\x81\x89\x02\x81\x81\x00\xa1\x71\x90\x77\x86\x8a\xc7\xb8\xfc\x2a\x45" |
|
|
|
"\x82\x6d\xee\xeb\x35\x3a\x18\x3f\xb6\xb0\x1e\xb1\xd3\x09\x6b\x05\x4d\xec" |
|
|
|
"\x1c\x37\x6f\x09\x31\x32\xda\x21\x8a\x49\x0e\x16\x28\xed\x9a\x30\xf3\x14" |
|
|
|
"\x53\xfd\x5b\xb0\xf6\x4a\x5d\x52\xe1\xda\xe1\x40\x6e\x65\xbf\xca\x45\xd9" |
|
|
|
"\x62\x96\x4a\x1e\x11\xc4\x61\x83\x1f\x58\x8d\x5e\xd0\x12\xaf\xa5\xec\x9b" |
|
|
|
"\x97\x2f\x6c\xb2\x82\x4a\x73\xd0\xd3\x9a\xc9\x69\x6b\x24\x3c\x82\x6f\xee" |
|
|
|
"\x4d\x0c\x7e\xdf\xd7\xae\xea\x3a\xeb\x04\x27\x8d\x43\x81\x59\xa7\x90\x56" |
|
|
|
"\xc1\x69\x42\xb3\xaf\x1c\x8d\x4e\xbf\x02\x03\x01\x00\x01"; |
|
|
|
|
|
|
|
// kOAEPCiphertext1 is a sample encryption of |kPlaintext| with |kKey1| using |
|
|
|
// RSA OAEP. |
|
|
|
static const uint8_t kOAEPCiphertext1[] = |
|
|
@@ -467,9 +477,13 @@ TEST(RSATest, CheckFIPS) { |
|
|
|
bssl::UniquePtr<RSA> rsa( |
|
|
|
RSA_private_key_from_bytes(kFIPSKey, sizeof(kFIPSKey) - 1)); |
|
|
|
ASSERT_TRUE(rsa); |
|
|
|
|
|
|
|
EXPECT_TRUE(RSA_check_key(rsa.get())); |
|
|
|
EXPECT_TRUE(RSA_check_fips(rsa.get())); |
|
|
|
|
|
|
|
// Check that RSA_check_fips works on a public key. |
|
|
|
bssl::UniquePtr<RSA> pub( |
|
|
|
RSA_public_key_from_bytes(kFIPSPublicKey, sizeof(kFIPSPublicKey) - 1)); |
|
|
|
ASSERT_TRUE(pub); |
|
|
|
EXPECT_TRUE(RSA_check_fips(pub.get())); |
|
|
|
} |
|
|
|
|
|
|
|
TEST(RSATest, BadKey) { |
|
|
|