Access encrypted Key Value Map values into JavaScript policy

Hi All,

Hope you are doing good.

I have a requirement in which i have to send the private values getting set into key value map to JavaScript policy. I need to perform couple of operations on the private values getting fetched from the key value map policy. after performing those operations i need to concatenate the private values and set it in a context variable and send it to assign message policy. logic is perfectly working fine for non encrypted key value map values. but for the encrypted one i am getting null values into the JavaScript code. is there any way we can populate it. encrypted value would also work fine but it should not return null. Please suggest if this is a known issue or if any workaround is there.

Note: We're using APIGEE on-premise private installation and version is 4.19.01

Thank you in advance.

Regards,

Tushar Gupta

@Mike Dunker @Google

@Dino

Solved Solved
0 1 555
1 ACCEPTED SOLUTION

There is one difference between encrypted and non-encrypted KVMs.

When you use KVM Get with an encrypted KVM, you must specify a variable with a prefix of "private."

This works with a non-encrypted KVM, but not with an encrypted KVM:

  <Get assignTo='somevariable'>
    <Key>
      <Parameter>rsa_private_key</Parameter>
    </Key>
  </Get>


If you want to retrieve from an encrypted KVM, then you must use the private. prefix:

  <Get assignTo='private.somevariable'>
    <Key>
      <Parameter>rsa_private_key</Parameter>
    </Key>
  </Get>


Your JavaScript can continue to work as it always has. Though of course you would need to call context.getVariable() on the variable with the private. prefix.

View solution in original post

1 REPLY 1

There is one difference between encrypted and non-encrypted KVMs.

When you use KVM Get with an encrypted KVM, you must specify a variable with a prefix of "private."

This works with a non-encrypted KVM, but not with an encrypted KVM:

  <Get assignTo='somevariable'>
    <Key>
      <Parameter>rsa_private_key</Parameter>
    </Key>
  </Get>


If you want to retrieve from an encrypted KVM, then you must use the private. prefix:

  <Get assignTo='private.somevariable'>
    <Key>
      <Parameter>rsa_private_key</Parameter>
    </Key>
  </Get>


Your JavaScript can continue to work as it always has. Though of course you would need to call context.getVariable() on the variable with the private. prefix.