SAML payload url encoding after Base64 - spring-saml

In a IDP initiated environment the payload is not able to decode it.
Getting exception in decoder.decode(samlContext);
So after analysing I found that the payload is encrypted with URL encoding after Base64 encoding.
Any way there if I can consume this payload and decode it.

This issue I was facing due to some copy paste issue, now solved.

Related

Dynamics 365 Webhook Json Remote execution context sent with German characters as rubbish

Using Plugin Registration, I registered webhook, Power automate and sample webhook as well.
Json (Remote execution context) sent to webhook seems to be fine but when German characters appears in field values, it sends as rubbish.
I tried adding httpheader to webhook as Content-type: application/json; charset=utf-8 or Accept-Charset: utf-8
but this did not helped.
Did anyone previously faced similar issue?
I suspect there is bug from Dynamics-crm side especially plugin registration tool, but I might be wrong.
You can use IServiceEndpointNotificationService to encode the content before sending or alternatively what you can do is creating an Azure Function that you will invoke on your Webhook and inside the function you should encode the content to UTF-8 and make a second call to you final endpoint, you can do there also further transformation of data if needed.

How to determine encoding format of string and then decode it

I have captured request content of a mobile app (iphone) through a proxy (Charles Proxy), but the content seems to be encoded which I want to decode into human-readable format. As the source of the encoding format is not known, I cannot decode it, I have tried several online tools with different source formats but none of it decode it properly. How to decode such content properly?
pv8WkNKPolGj6EgiYKNXzlGAOjGku5ewenklAlyQ58wpWcLBH7y4S0ZZ12JODvWSLpvoJbeffKgDxvaTMTt17qLUNKsiTroaldStWO5n+H1BdI+IXLFusgipOtpUUvnvbA52x0Gwi349bfXNCD9EamQBEPD8J+zreVtYwvgL9b7ohgvnoq2WXpOeHs9hTJnWEwAiLzPTocVDzr3kzLsMsB6N10X+pnJ/QODY3RDklqQeb5o6vzvTapgs5G/R2ZjsvzBTJ/u+DuLxulVfNUAKXGjh4CVAWjWzsymuxo1CaI7s3nPW17Kx9BNYxw37r4TKAqTMA+A0uP+NPi17KsC9ag==
UPDATE:
The request/response content is encrypted by java cryptography before sending it in the network using the AES cipher algorithm and cipher transformation is done with AES/CBC/PKCS5Padding. I am able to decrypt it by debugging APK code and finding the secret key used to encrypt the content. It's really another level of encryption before sending it in the network.

Usuing CURL to POST SAML Response in Spring-SAML

I am trying to use the CURL Command to POST the response receive from the IDP, i.e. the SAML Response to the SP on one of the alias which I have.
I am using Spring-SAML Framework.
Can someone help me with the exact command which needs to be used if I want to post the SAML Response to the SP using CURL Command ?
SAML Response is fairly complicated and contains a range of values which expire over time, need to correspond to the originally send SAML Authentication Request and depend on configuration of the particular SAML federation. For these reasons there's no way to craft a generic CURL Command.
curl --data #path/to/file https://host
where file contains SAMLResponse= followed by the Base64 encoded and then URL-encoded SAML Response XML, e.g.
SAMLResponse=PHNhbWxwOlJlc3B...snip...R0cmlidXRlU3RhdGVtZW50PgogIDwvc2FtbDpBc3NlcnRpb24%2BCjwvc2FtbHA6UmVzcG9uc2U%2B
If you don't URL-encode the Base64 encoded string, any + characters will cause the XML to be truncated and parsing to fail. The errors I saw in the Keycloak logs were along the lines of Element type "Response" must be followed by either attribute specifications, ">" or "/>".

How to prevent other from tampering response msg in HTTPS?

In HTTPS, only server hold the private key and is able to decode the message.
My doubt is whether server will encode the response before sending it to client?
If so, how does the client decode it, since it does not have the private key?
If not, how does it prevent others from tampering the response message?
I think I can answer my question by myself. The server will encrypt the response with public-key and send it to client. Other than that, the server will send a checksum as well, which acts as the signature. The checksum is generated based on the private-key that only server knows, therefore it is hard for others to fabricate it. Thus, if anyone trying tampering the message, it won't match the checksum.

Configuration setting for decode base64 string to image Mail server

In our application we are reading mail body which client have replied to our mail address and saved it to our database table.
When some clients reply on our email address mail body contains base64 string with header Content-Transfer-Encoding: base64.
Can I know if there is any configuration setting on mail server that it will convert the base64 string into image.
This problem occurs only with some clients not all. I am guessing that these clients have base64 image in their signature.
Any help will be much appreciated.
Please check below image for what response we get in our application.
It isn't the server that needs to convert anything. base64 encoded images are already images.
It is your client, whatever you are using to view the emails that needs to interpret the embedded base64 encoding and display it as an image to you.

Resources