I think that the certificate or secret you are using is not correctly encoded in Base-64. You can use online tools or PowerShell to verify the encoding.
$certPath = "path\to\your\certificate.pfx"
$certBytes = [System.IO.File]::ReadAllBytes($certPath)
$base64Cert = [System.Convert]::ToBase64String($certBytes)
$base64Cert
If you are using Azure Key Vault to store the certificate or secret, verify that the secret is correctly stored and retrieved.
$secret = Get-AzKeyVaultSecret -VaultName "YourKeyVaultName" -Name "YourSecretName"
$secretValue = $secret.SecretValueText
$secretValue
Or, instead of using a certificate, you can use a client secret for authentication. Ensure that the client secret is correctly configured in Azure Active Directory and Azure Key Vault.
You can also use OAuth 2.0 authentication to connect to SharePoint. This method involves registering an application in Azure AD and obtaining an access token.