ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

"The request sent by the client was syntactically incorrect" when attempting Private Key import using GatewayMigrationUtility.sh

book

Article ID: 226140

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

We have a PFX file that contains a root certificate, an intermediate certificate, and a server certificate. On my Linux system, I use the base64 command to generate the payload of our PFX file.

base64 | example.pfx

Which returns a base 64 string, something like this.

abc123qwe567lkj78...

The PFX file contains the following alias.

friendlyName: some-test.somedomain.com

Let's say the password for the PFX file is itsa&secret!

I create example.xml that will be used for the import. My XML file looks like this.

<l7:PrivateKeyImportContext xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">

  <l7:Pkcs12Data>abc123qwe567lkj78...</l7:Pkcs12Data>

<l7:Alias>some-test.somedomain.com</l7:Alias>

  <l7:Password>itsa&secret!</l7:Password>

</l7:PrivateKeyImportContext>

And then I issue this command to perform the import.

GatewayMigrationUtility.sh restman -argFile example.properties -method POST -path '1.0/privateKeys/00000000000000000000000000000002:some-test.somedomain.com/import' -request example.xml

The following is being returned.

Status: 400 Bad Request

<h3>The request sent by the client was syntactically incorrect.</h3>

 

Environment

Release :

Component :

Resolution

When using XML (like a restman xml) any value with special reserved XML chars which are,

" to  &quot;
' to  &apos;
< to  &lt;
> to  &gt;
& to  &amp;

Need to be properly escaped as above so for example for a Private Key password that contains a & like,

  <l7:Password>itsa&secret!</l7:Password>

It needs to be updated to be encoded like,

  <l7:Password>itsa&amp;secret!</l7:Password>