|
|
db363b |
From 0d34c97be1c761a9eb12692e4cc4eac58feb7d19 Mon Sep 17 00:00:00 2001
|
|
|
db363b |
From: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
db363b |
Date: Tue, 15 Jun 2021 14:45:14 +0200
|
|
|
db363b |
Subject: [PATCH 4/7] Mass-replace LASSO_SIGNATURE_METHOD_RSA_SHA1 with
|
|
|
db363b |
lasso_get_default_signature_method() (#54037)
|
|
|
db363b |
|
|
|
db363b |
This should be backwards-compatible but at the same time use the
|
|
|
db363b |
selected default instead of RSA-SHA1.
|
|
|
db363b |
|
|
|
db363b |
Related:
|
|
|
db363b |
https://dev.entrouvert.org/issues/54037
|
|
|
db363b |
---
|
|
|
db363b |
lasso/id-ff/defederation.c | 2 +-
|
|
|
db363b |
lasso/id-ff/logout.c | 6 +++---
|
|
|
db363b |
lasso/id-ff/name_identifier_mapping.c | 4 ++--
|
|
|
db363b |
lasso/id-ff/name_registration.c | 4 ++--
|
|
|
db363b |
lasso/id-ff/provider.c | 2 +-
|
|
|
db363b |
lasso/xml/tools.c | 2 +-
|
|
|
db363b |
tests/basic_tests.c | 6 +++---
|
|
|
db363b |
7 files changed, 13 insertions(+), 13 deletions(-)
|
|
|
db363b |
|
|
|
db363b |
diff --git a/lasso/id-ff/defederation.c b/lasso/id-ff/defederation.c
|
|
|
db363b |
index d711e4eed..d2382f4ae 100644
|
|
|
db363b |
--- a/lasso/id-ff/defederation.c
|
|
|
db363b |
+++ b/lasso/id-ff/defederation.c
|
|
|
db363b |
@@ -251,7 +251,7 @@ lasso_defederation_init_notification(LassoDefederation *defederation, gchar *rem
|
|
|
db363b |
nameIdentifier,
|
|
|
db363b |
profile->server->certificate ?
|
|
|
db363b |
LASSO_SIGNATURE_TYPE_WITHX509 : LASSO_SIGNATURE_TYPE_SIMPLE,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1);
|
|
|
db363b |
+ lasso_get_default_signature_method());
|
|
|
db363b |
if (profile->msg_relayState) {
|
|
|
db363b |
message(G_LOG_LEVEL_WARNING,
|
|
|
db363b |
"RelayState was defined but can't be used "\
|
|
|
db363b |
diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c
|
|
|
db363b |
index 20d04ed82..d307db586 100644
|
|
|
db363b |
--- a/lasso/id-ff/logout.c
|
|
|
db363b |
+++ b/lasso/id-ff/logout.c
|
|
|
db363b |
@@ -396,7 +396,7 @@ lasso_logout_build_response_msg(LassoLogout *logout)
|
|
|
db363b |
profile->server->certificate ?
|
|
|
db363b |
LASSO_SIGNATURE_TYPE_WITHX509 :
|
|
|
db363b |
LASSO_SIGNATURE_TYPE_SIMPLE,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1));
|
|
|
db363b |
+ lasso_get_default_signature_method()));
|
|
|
db363b |
} else if (profile->http_request_method == LASSO_HTTP_METHOD_REDIRECT) {
|
|
|
db363b |
lasso_assign_new_gobject(profile->response,
|
|
|
db363b |
lasso_lib_logout_response_new_full(
|
|
|
db363b |
@@ -608,7 +608,7 @@ lasso_logout_init_request(LassoLogout *logout, char *remote_providerID,
|
|
|
db363b |
nameIdentifier,
|
|
|
db363b |
profile->server->certificate ?
|
|
|
db363b |
LASSO_SIGNATURE_TYPE_WITHX509 : LASSO_SIGNATURE_TYPE_SIMPLE,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1);
|
|
|
db363b |
+ lasso_get_default_signature_method());
|
|
|
db363b |
} else { /* http_method == LASSO_HTTP_METHOD_REDIRECT */
|
|
|
db363b |
is_http_redirect_get_method = TRUE;
|
|
|
db363b |
lib_logout_request = (LassoLibLogoutRequest*)lasso_lib_logout_request_new_full(
|
|
|
db363b |
@@ -990,7 +990,7 @@ lasso_logout_validate_request(LassoLogout *logout)
|
|
|
db363b |
logout_request,
|
|
|
db363b |
profile->server->certificate ?
|
|
|
db363b |
LASSO_SIGNATURE_TYPE_WITHX509 : LASSO_SIGNATURE_TYPE_SIMPLE,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1));
|
|
|
db363b |
+ lasso_get_default_signature_method()));
|
|
|
db363b |
}
|
|
|
db363b |
if (profile->http_request_method == LASSO_HTTP_METHOD_REDIRECT) {
|
|
|
db363b |
lasso_assign_new_gobject(profile->response, lasso_lib_logout_response_new_full(
|
|
|
db363b |
diff --git a/lasso/id-ff/name_identifier_mapping.c b/lasso/id-ff/name_identifier_mapping.c
|
|
|
db363b |
index 80af6fec4..f84020eb6 100644
|
|
|
db363b |
--- a/lasso/id-ff/name_identifier_mapping.c
|
|
|
db363b |
+++ b/lasso/id-ff/name_identifier_mapping.c
|
|
|
db363b |
@@ -259,7 +259,7 @@ lasso_name_identifier_mapping_init_request(LassoNameIdentifierMapping *mapping,
|
|
|
db363b |
targetNamespace,
|
|
|
db363b |
profile->server->certificate ?
|
|
|
db363b |
LASSO_SIGNATURE_TYPE_WITHX509 : LASSO_SIGNATURE_TYPE_SIMPLE,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1);
|
|
|
db363b |
+ lasso_get_default_signature_method());
|
|
|
db363b |
if (LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_REQUEST(profile->request) == FALSE) {
|
|
|
db363b |
return critical_error(LASSO_PROFILE_ERROR_BUILDING_REQUEST_FAILED);
|
|
|
db363b |
}
|
|
|
db363b |
@@ -458,7 +458,7 @@ lasso_name_identifier_mapping_validate_request(LassoNameIdentifierMapping *mappi
|
|
|
db363b |
request,
|
|
|
db363b |
profile->server->certificate ?
|
|
|
db363b |
LASSO_SIGNATURE_TYPE_WITHX509 : LASSO_SIGNATURE_TYPE_SIMPLE,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1);
|
|
|
db363b |
+ lasso_get_default_signature_method());
|
|
|
db363b |
|
|
|
db363b |
if (LASSO_IS_LIB_NAME_IDENTIFIER_MAPPING_RESPONSE(profile->response) == FALSE) {
|
|
|
db363b |
return critical_error(LASSO_PROFILE_ERROR_BUILDING_RESPONSE_FAILED);
|
|
|
db363b |
diff --git a/lasso/id-ff/name_registration.c b/lasso/id-ff/name_registration.c
|
|
|
db363b |
index 11dbf24fe..076cf9624 100644
|
|
|
db363b |
--- a/lasso/id-ff/name_registration.c
|
|
|
db363b |
+++ b/lasso/id-ff/name_registration.c
|
|
|
db363b |
@@ -339,7 +339,7 @@ lasso_name_registration_init_request(LassoNameRegistration *name_registration,
|
|
|
db363b |
idpNameIdentifier, spNameIdentifier, oldNameIdentifier,
|
|
|
db363b |
profile->server->certificate ?
|
|
|
db363b |
LASSO_SIGNATURE_TYPE_WITHX509 : LASSO_SIGNATURE_TYPE_SIMPLE,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1);
|
|
|
db363b |
+ lasso_get_default_signature_method());
|
|
|
db363b |
if (profile->request == NULL) {
|
|
|
db363b |
return critical_error(LASSO_PROFILE_ERROR_BUILDING_REQUEST_FAILED);
|
|
|
db363b |
}
|
|
|
db363b |
@@ -575,7 +575,7 @@ lasso_name_registration_validate_request(LassoNameRegistration *name_registratio
|
|
|
db363b |
LASSO_LIB_REGISTER_NAME_IDENTIFIER_REQUEST(profile->request),
|
|
|
db363b |
profile->server->certificate ?
|
|
|
db363b |
LASSO_SIGNATURE_TYPE_WITHX509 : LASSO_SIGNATURE_TYPE_SIMPLE,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1);
|
|
|
db363b |
+ lasso_get_default_signature_method());
|
|
|
db363b |
if (LASSO_IS_LIB_REGISTER_NAME_IDENTIFIER_RESPONSE(profile->response) == FALSE) {
|
|
|
db363b |
return critical_error(LASSO_PROFILE_ERROR_BUILDING_RESPONSE_FAILED);
|
|
|
db363b |
}
|
|
|
db363b |
diff --git a/lasso/id-ff/provider.c b/lasso/id-ff/provider.c
|
|
|
db363b |
index 32a907d43..961c3669d 100644
|
|
|
db363b |
--- a/lasso/id-ff/provider.c
|
|
|
db363b |
+++ b/lasso/id-ff/provider.c
|
|
|
db363b |
@@ -1274,7 +1274,7 @@ lasso_provider_load_public_key(LassoProvider *provider, LassoPublicKeyType publi
|
|
|
db363b |
|
|
|
db363b |
if (public_key != NULL) {
|
|
|
db363b |
xmlSecKey *key = lasso_xmlsec_load_private_key(public_key, NULL,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1, NULL);
|
|
|
db363b |
+ lasso_get_default_signature_method(), NULL);
|
|
|
db363b |
if (key) {
|
|
|
db363b |
lasso_list_add_new_sec_key(keys, key);
|
|
|
db363b |
} else {
|
|
|
db363b |
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c
|
|
|
db363b |
index ce322ee1f..cf6dade09 100644
|
|
|
db363b |
--- a/lasso/xml/tools.c
|
|
|
db363b |
+++ b/lasso/xml/tools.c
|
|
|
db363b |
@@ -2746,7 +2746,7 @@ next:
|
|
|
db363b |
content = xmlNodeGetContent(key_value);
|
|
|
db363b |
if (content) {
|
|
|
db363b |
result = lasso_xmlsec_load_private_key_from_buffer((char*)content,
|
|
|
db363b |
- strlen((char*)content), NULL, LASSO_SIGNATURE_METHOD_RSA_SHA1, NULL);
|
|
|
db363b |
+ strlen((char*)content), NULL, lasso_get_default_signature_method(), NULL);
|
|
|
db363b |
xmlFree(content);
|
|
|
db363b |
}
|
|
|
db363b |
}
|
|
|
db363b |
diff --git a/tests/basic_tests.c b/tests/basic_tests.c
|
|
|
db363b |
index f9cfef266..0652abc28 100644
|
|
|
db363b |
--- a/tests/basic_tests.c
|
|
|
db363b |
+++ b/tests/basic_tests.c
|
|
|
db363b |
@@ -2008,16 +2008,16 @@ START_TEST(test14_lasso_key)
|
|
|
db363b |
|
|
|
db363b |
check_true(g_file_get_contents(TESTSDATADIR "sp1-la/private-key-raw.pem", &buffer, &length, NULL));
|
|
|
db363b |
check_not_null(key = lasso_key_new_for_signature_from_memory(buffer,
|
|
|
db363b |
- length, NULL, LASSO_SIGNATURE_METHOD_RSA_SHA1,
|
|
|
db363b |
+ length, NULL, lasso_get_default_signature_method(),
|
|
|
db363b |
NULL));
|
|
|
db363b |
lasso_release_gobject(key);
|
|
|
db363b |
check_not_null(key = lasso_key_new_for_signature_from_file(TESTSDATADIR
|
|
|
db363b |
- "sp1-la/private-key-raw.pem", NULL, LASSO_SIGNATURE_METHOD_RSA_SHA1,
|
|
|
db363b |
+ "sp1-la/private-key-raw.pem", NULL, lasso_get_default_signature_method(),
|
|
|
db363b |
NULL));
|
|
|
db363b |
lasso_release_gobject(key);
|
|
|
db363b |
base64_encoded = g_base64_encode(BAD_CAST buffer, length);
|
|
|
db363b |
check_not_null(key = lasso_key_new_for_signature_from_base64_string(base64_encoded, NULL,
|
|
|
db363b |
- LASSO_SIGNATURE_METHOD_RSA_SHA1, NULL));
|
|
|
db363b |
+ lasso_get_default_signature_method(), NULL));
|
|
|
db363b |
lasso_release_string(base64_encoded);
|
|
|
db363b |
lasso_release_string(buffer);
|
|
|
db363b |
lasso_release_gobject(key);
|
|
|
db363b |
--
|
|
|
db363b |
2.26.3
|
|
|
db363b |
|