I used this to get the public key from the cert:
openssl x509 -in server_cert_06235331-ef34-45e5-b407-9fa340ab0b48.pem -pubkey -noout > vmss_mle_server_public_key.pem
Here is what I have in ruby:
JOSE::JWE.block_encrypt(
JOSE::JWK.from_pem_file("server_public_key.pem"),
body,
{
"alg" => "RSA-OAEP-256",
"enc" => "A256GCM",
"kid" => "06235331-ef34-45e5-b407-9fa340ab0b48",
"iat" => (Time.stamp * 1000).round
}
)
unencrypted body (only the required fields with example values from API docs):
{
"searchTerminatedRequest": {
"acquirerBID": "10048640",
"acquirerCountryOrRegion": "JP",
"globalSearch": false,
"terminatedRecordSearchCriteria": {
"address": {
"city": "St Albans",
"countryOrRegion": "JP",
"streetAddress": "80 Wood Street"
},
"businessPhoneNumbers": [
"+861071111222"
],
"category": "1",
"DBAName": "Snap Photoshop Ltd",
"principals": [
{
"name": "Bill Smith"
}
],
"tradeOverInternet": false
}
}
}
encrypted body:
{"encData":"eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2R0NNIiwiaWF0IjoxNzIzODI3NTA2MjU2LCJraWQiOiIwNjIzNTMzMS1lZjM0LTQ1ZTUtYjQwNy05ZmEzNDBhYjBiNDgifQ.PzHSRdBBl-P8wvW8Uow2aZGdp_tT77WE6qh8mgxvSPrnhAN5DH6MHRCKIAHwu2-x54gcRzGJ74scFcV_Z8Jt5WMlexDwFU_Z3y4vYM30eyIzD9bbZ5gzO7Xgf2jgUJMcc1ZSEA7okC-uO_ZpVJP--zP81nxnPzb5TxwdmyXPxS03rGFCZAPu02vqTLvdacNPM-pGCCf5FX6UqXNuizeJYZ59121Z6MFDwO-HXL2avfKtFF6M4QMjupby4wjoxMeCmyMkauFplwWjUikf-o-1HDYRlMWnBJMzXpCSfEBOB5Z0ZwjdmLIfeVaDqkPSV7QazuwUMWzoZ2q-sYI-oIprLQ.rSFSmUZGwraz4CNK.ilWiDWeL6YZjKjswpXL9uRUgWwjq3OnlqteYiAQun4XMVCmRVgQM_BeG6Ych6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