The first thing I notice is that the CSR length is shorter for me than what is in the integration sandbox (Zatca)
the sandbox csr looks like:
{
"csr": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlJQ0ZUQ0NBYndDQVFBd2RURUxNQWtHQTFVRUJoTUNVMEV4RmpBVUJnTlZCQXNNRFZKcGVXRmthQ0JDY21GdQpZMmd4SmpBa0JnTlZCQW9NSFUxaGVHbHRkVzBnVTNCbFpXUWdWR1ZqYUNCVGRYQndiSGtnVEZSRU1TWXdKQVlEClZRUUREQjFVVTFRdE9EZzJORE14TVRRMUxUTTVPVGs1T1RrNU9Ua3dNREF3TXpCV01CQUdCeXFHU000OUFnRUcKQlN1QkJBQUtBMElBQktGZ2ltdEVtdlJTQkswenI5TGdKQXRWU0NsOFZQWno2Y2RyNVgrTW9USG84dkhOTmx5Vwo1UTZ1N1Q4bmFQSnF0R29UakpqYVBJTUo0dTE3ZFNrL1ZIaWdnZWN3Z2VRR0NTcUdTSWIzRFFFSkRqR0IxakNCCjB6QWhCZ2tyQmdFRUFZSTNGQUlFRkF3U1drRlVRMEV0UTI5a1pTMVRhV2R1YVc1bk1JR3RCZ05WSFJFRWdhVXcKZ2FLa2daOHdnWnd4T3pBNUJnTlZCQVFNTWpFdFZGTlVmREl0VkZOVWZETXRaV1F5TW1ZeFpEZ3RaVFpoTWkweApNVEU0TFRsaU5UZ3RaRGxoT0dZeE1XVTBORFZtTVI4d0hRWUtDWkltaVpQeUxHUUJBUXdQTXprNU9UazVPVGs1Ck9UQXdNREF6TVEwd0N3WURWUVFNREFReE1UQXdNUkV3RHdZRFZRUWFEQWhTVWxKRU1qa3lPVEVhTUJnR0ExVUUKRHd3UlUzVndjR3g1SUdGamRHbDJhWFJwWlhNd0NnWUlLb1pJemowRUF3SURSd0F3UkFJZ1NHVDBxQkJ6TFJHOApJS09melI1L085S0VicHA4bWc3V2VqUlllZkNZN3VRQ0lGWjB0U216MzAybmYvdGo0V2FxbVYwN01qZVVkVnVvClJJckpLYkxtUWZTNwotLS0tLUVORCBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0K"
}
whereas mines looks like:
{
"csr":
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURSBSRVFVRVNULS0tLS0KTUlIOE1JR2tBZ0VBTUVVeEN6QUpCZ05WQkFZVEFrRlZNUk13RVFZRFZRUUlEQXBUYjIxbExWTjBZWFJsTVNFdwpId1lEVlFRS0RCaEpiblJsY201bGRDQlhhV1JuYVhSeklGQjBlU0JNZEdRd1ZqQVFCZ2NxaGtqT1BRSUJCZ1VyCmdRUUFDZ05DQUFSSDNUL1dCUnptcmoweUc2cGptTi9OYitlTC9ibEsxWUZ2T0V0UFhya1BOcEZzU2NtMUJ5OXAKMHo3QWVJelNOTXhjTFA0UXAwYmpLS2cwOWh4TVZVVHRvQUF3Q1FZSEtvWkl6ajBFQVFOSUFEQkZBaUVBenFJUgp5WEhIaDI0b0U5VW9CU1N1dWsydjRrd3k1UWwrdDhscXc5bC9CVFlDSUVRRWVCY1V3R2dBWGVBazRMNVQ1YjNVClVjek5XZTlrc3pxYlo5VXUzeHZJCi0tLS0tRU5EIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLQo=
}
Should I be concerned about this?
Also because this is sandbox I am using dummy data eg:
$config_data = array(
'emailAddress' => 'test_email@gmail.com',
'commonName' => 'mydomain.com',
'country' => 'SA',
'organizationalUnitName' => 'Testing Branch',
'organizationName' => 'Test Company',
'serialNumber' => '1-Model|2-3492842|3-49182743421',
'vatNumber' => '317460736806263',
'invoiceType' => '1100',
'registeredAddress' => 'TestAddress',
'businessCategory' => 'Software Development'
);
define('CONFIG_CNF_FILE_TEMPLATE', "oid_section=OIDS
[ OIDS ]
certificateTemplateName= 1.3.6.1.4.1.311.20.2
[req]
default_bits=2048
emailAddress=__emailAddress
req_extensions=v3_req
x509_extensions=v3_Ca
prompt=no
default_md=sha256
req_extensions=req_ext
distinguished_name=dn
[dn]
CN=__commonName
C=__country
OU=__organizationalUnitName
O=__organizationName
[v3_req]
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
[req_ext]
certificateTemplateName = ASN1:PRINTABLESTRING:PREZATCA-code-Signing
subjectAltName = dirName:alt_names
[alt_names]
SN=__serialNumber
UID=__vatNumber
title=__invoiceType
registeredAddress=__registeredAddress
businessCategory=__businessCategory
# [v3_Ca]
# subjectKeyIdentifier=hash
# authorityKeyIdentifier=keyid:always,issue");
$template = CONFIG_CNF_FILE_TEMPLATE;
foreach ($config_data as $key => $value) {
$configCnf = str_replace("__$key", $value, $template);
$template = $configCnf;
}
This is in PHP. Any help is appreciated. Note: Even if I use the proper data it still gives me invalid request. (The length of the CSR is still shorter)
Also is there anyway to get a more verbose error response than just $response string (15) "Invalid Request"