{"id":1193,"date":"2025-10-09T07:17:43","date_gmt":"2025-10-09T00:17:43","guid":{"rendered":"https:\/\/portal-atlasx.cdg.co.th\/home\/docs\/atlasx-web-service-v8-0\/features\/decrypt-payload\/"},"modified":"2026-03-27T09:01:50","modified_gmt":"2026-03-27T02:01:50","slug":"decrypt-payload","status":"publish","type":"docs","link":"https:\/\/portal-atlasx.cdg.co.th\/home\/docs\/axws\/features\/decrypt-payload\/","title":{"rendered":"Decrypt payload"},"content":{"rendered":"\n\n\n<p>AtlasX Web Service&nbsp;\u0e23\u0e2d\u0e07\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e16\u0e2d\u0e14\u0e23\u0e2b\u0e31\u0e2a payload \u0e17\u0e35\u0e48\u0e40\u0e02\u0e49\u0e32\u0e23\u0e2b\u0e31\u0e2a\u0e21\u0e32\u0e14\u0e49\u0e27\u0e22 RSA \u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49&nbsp;<code>DecryptPayload<\/code>&nbsp;\u0e0b\u0e36\u0e48\u0e07\u0e2d\u0e48\u0e32\u0e19 private key \u0e08\u0e32\u0e01 configuration \u0e41\u0e25\u0e30\u0e16\u0e2d\u0e14\u0e23\u0e2b\u0e31\u0e2a Base64 string \u0e01\u0e25\u0e31\u0e1a\u0e40\u0e1b\u0e47\u0e19\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e1b\u0e01\u0e15\u0e34<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u0e01\u0e32\u0e23\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32<\/strong><\/h2>\n\n\n\n<p>\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e04\u0e48\u0e32 RSA key pair \u0e43\u0e19\u0e44\u0e1f\u0e25\u0e4c&nbsp;<code>.env<\/code><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>App__AsymmetricKey__HttpPayloadKey__PrivateKey=-----BEGIN RSA PRIVATE KEY-----...-----END RSA PRIVATE KEY-----\nApp__AsymmetricKey__HttpPayloadKey__PublicKey=-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">App__AsymmetricKey__HttpPayloadKey__PrivateKey<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">-----BEGIN<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">RSA<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">PRIVATE<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">KEY-----...-----END<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">RSA<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">PRIVATE<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">KEY-----<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">App__AsymmetricKey__HttpPayloadKey__PublicKey<\/span><span style=\"color: #D4D4D4\">=<\/span><span style=\"color: #CE9178\">-----BEGIN<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">PUBLIC<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">KEY-----...-----END<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">PUBLIC<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">KEY-----<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td><strong>Field<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td><code>PrivateKey<\/code><\/td><td>RSA private key \u0e43\u0e19\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a PEM \u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e16\u0e2d\u0e14\u0e23\u0e2b\u0e31\u0e2a payload<\/td><\/tr><tr><td><code>PublicKey<\/code><\/td><td>RSA public key \u0e43\u0e19\u0e23\u0e39\u0e1b\u0e41\u0e1a\u0e1a PEM \u0e43\u0e0a\u0e49\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e40\u0e02\u0e49\u0e32\u0e23\u0e2b\u0e31\u0e2a payload \u0e1d\u0e31\u0e48\u0e07 client<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Service Registration<\/strong><\/h2>\n\n\n\n<p>\u0e25\u0e07\u0e17\u0e30\u0e40\u0e1a\u0e35\u0e22\u0e19&nbsp;<code>DecryptPayload<\/code>&nbsp;\u0e40\u0e02\u0e49\u0e32 DI container \u0e43\u0e19&nbsp;<code>Program.cs<\/code><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>builder.Services.AddScoped&lt;DecryptPayload>();<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">builder<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">Services<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">AddScoped<\/span><span style=\"color: #D4D4D4\">&lt;<\/span><span style=\"color: #4EC9B0\">DecryptPayload<\/span><span style=\"color: #D4D4D4\">&gt;();<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Inject&nbsp;DecryptPayload<\/strong><\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>public class MyService\n{\n    private readonly DecryptPayload _decryptPayload;\n\n    public MyService(DecryptPayload decryptPayload)\n    {\n        _decryptPayload = decryptPayload;\n    }\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #9CDCFE\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">MyService<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">private<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">readonly<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">DecryptPayload<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">_decryptPayload<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">MyService<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">DecryptPayload<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">decryptPayload<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">        <\/span><span style=\"color: #9CDCFE\">_decryptPayload<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">decryptPayload<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>\u0e16\u0e2d\u0e14\u0e23\u0e2b\u0e31\u0e2a Payload<\/strong><\/h3>\n\n\n\n<p>\u0e23\u0e31\u0e1a encrypted payload \u0e08\u0e32\u0e01 request \u0e41\u0e25\u0e49\u0e27\u0e40\u0e23\u0e35\u0e22\u0e01&nbsp;<code>DecryptString()<\/code>&nbsp;\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e16\u0e2d\u0e14\u0e23\u0e2b\u0e31\u0e2a\u0e01\u0e25\u0e31\u0e1a\u0e40\u0e1b\u0e47\u0e19\u0e02\u0e49\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e1b\u0e01\u0e15\u0e34<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-Fira-Code\" style=\"font-size:.875rem;font-family:Code-Pro-Fira-Code,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>&#91;HttpPost(\"submit\")&#93;\npublic IActionResult Submit(&#91;FromBody&#93; EncryptedPayloadWrapper request)\n{\n    var decrypted = _decryptPayload.DecryptString(request.Payload);\n    \/\/ \u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19 decrypted string \u0e15\u0e48\u0e2d\u0e44\u0e14\u0e49\u0e40\u0e25\u0e22\n    return Ok(decrypted);\n}<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&#91;<\/span><span style=\"color: #DCDCAA\">HttpPost<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;submit&quot;<\/span><span style=\"color: #D4D4D4\">)&#93;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">public<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">IActionResult<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">Submit<\/span><span style=\"color: #D4D4D4\">(&#91;<\/span><span style=\"color: #9CDCFE\">FromBody<\/span><span style=\"color: #D4D4D4\">&#93; <\/span><span style=\"color: #9CDCFE\">EncryptedPayloadWrapper<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">request<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #569CD6\">var<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">decrypted<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #9CDCFE\">_decryptPayload<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #DCDCAA\">DecryptString<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">request<\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #9CDCFE\">Payload<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #6A9955\">\/\/ \u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19 decrypted string \u0e15\u0e48\u0e2d\u0e44\u0e14\u0e49\u0e40\u0e25\u0e22<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">    <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">Ok<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">decrypted<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span><\/code><\/pre><\/div>\n","protected":false},"featured_media":0,"parent":1186,"menu_order":6,"comment_status":"open","ping_status":"closed","template":"","meta":{"nav_title":"","positive":"","negative":"","footnotes":""},"docs_category":[],"class_list":["post-1193","docs","type-docs","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs\/1193","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/comments?post=1193"}],"version-history":[{"count":5,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs\/1193\/revisions"}],"predecessor-version":[{"id":4233,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs\/1193\/revisions\/4233"}],"up":[{"embeddable":true,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs\/1186"}],"wp:attachment":[{"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/media?parent=1193"}],"wp:term":[{"taxonomy":"docs_category","embeddable":true,"href":"https:\/\/portal-atlasx.cdg.co.th\/home\/wp-json\/wp\/v2\/docs_category?post=1193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}