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

"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.

abc123<sample base 64 string>...

The PFX file contains the following alias.

friendlyName: <server name><domain>.com

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

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>servername.domain.com</l7:Alias>

<l7:Password>password&password</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:servanename.domain.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>password&password</l7:Password>

It needs to be updated to be encoded like,

  <l7:Password>password&amp;password</l7:Password>