@@ -21634,6 +21634,23 @@ static int test_EccSigFailure_cm(void)
2163421634#endif /* !NO_RSA || HAVE_ECC */
2163521635#endif /* NO_CERTS */
2163621636
21637+ static int test_wc_CheckPrivateKey_RSA_pub_only(void)
21638+ {
21639+ EXPECT_DECLS;
21640+ #if !defined(NO_RSA) && !defined(NO_ASN_CRYPT) && \
21641+ !defined(NO_CHECK_PRIVATE_KEY) && \
21642+ (defined(WOLFSSL_RSA_PUBLIC_ONLY) || defined(WOLFSSL_RSA_VERIFY_ONLY))
21643+ /* With RSA public-only or verify-only, wc_CheckPrivateKey should return
21644+ * NOT_COMPILED_IN for RSA key types since private key operations are not
21645+ * available. */
21646+ ExpectIntEQ(wc_CheckPrivateKey(server_key_der_2048,
21647+ sizeof_server_key_der_2048, server_cert_der_2048,
21648+ sizeof_server_cert_der_2048, RSAk, NULL),
21649+ WC_NO_ERR_TRACE(NOT_COMPILED_IN));
21650+ #endif
21651+ return EXPECT_RESULT();
21652+ }
21653+
2163721654#if defined(HAVE_PK_CALLBACKS) && !defined(WOLFSSL_NO_TLS12)
2163821655#if !defined(NO_FILESYSTEM) && !defined(NO_DH) && \
2163921656 !defined(NO_AES) && defined(HAVE_AES_CBC) && \
@@ -32683,6 +32700,7 @@ TEST_CASE testCases[] = {
3268332700 TEST_DECL(test_EccSigFailure_cm),
3268432701 TEST_DECL(test_RsaSigFailure_cm),
3268532702#endif
32703+ TEST_DECL(test_wc_CheckPrivateKey_RSA_pub_only),
3268632704
3268732705 /* PKCS8 testing */
3268832706 TEST_DECL(test_wolfSSL_no_password_cb),
0 commit comments