guides:ws_store_checksum
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
guides:ws_store_checksum [2018/10/26 17:40] – brett.zamora | guides:ws_store_checksum [2019/06/04 23:51] (current) – brett.zamora | ||
---|---|---|---|
Line 2: | Line 2: | ||
- | The StoreChecksum web service is used to store the checksum of a Base64Document | + | The StoreChecksum web service is used to store the checksum |
+ | The StoreChecksum web service, returns a checksum key. The checksum key is the value that should be stored in either the RequestChecksumValue (agents) or ResponseChecksumValue(counties) property of the PRIA_DOCUMENT node, depending on who made the StoreChecksum request. | ||
+ | The following sample shows the checksum key stored in PRIA_DOCUMENT node: | ||
+ | <code xml> | ||
+ | < | ||
+ | </ | ||
+ | The checksum key is used in the ValidateChecksum web service to facilitate the process of validating a checksum value that was stored by another party. | ||
- | In October 2018, CeRTNA added a requirement to include a SALT value when preparing your encrypted password string. The sample code blocks included later in this page show how to obtain your SALT value and use it when encrypting your password. | ||
<color # | <color # | ||
- | {{tablelayout? | + | {{tablelayout? |
^ Method ^ URL ^ | ^ Method ^ URL ^ | ||
- | | POST | < | + | | POST | < |
Line 29: | Line 34: | ||
^ Key ^ Value ^ | ^ Key ^ Value ^ | ||
| Content-Type | application/ | | Content-Type | application/ | ||
+ | | access_token | {soft-token} | | ||
Line 35: | Line 41: | ||
{{tablelayout? | {{tablelayout? | ||
^ Parm Name ^ Req/Opt ^ Format ^ Description ^ | ^ Parm Name ^ Req/Opt ^ Format ^ Description ^ | ||
- | | user_name | + | | checksum |
- | | password | Required | [string] | Base64 encoded SHA1 hash. See Comment 1. | | + | |
<color # | <color # | ||
Line 43: | Line 47: | ||
{{tablelayout? | {{tablelayout? | ||
^ Parm Name ^ Format ^ Description ^ | ^ Parm Name ^ Format ^ Description ^ | ||
- | | access_token | + | | checksum_key |
- | | code | [string] | Upon login failure this parameter | + | | code | [string] | Exception conditions |
- | | message | [string] | Upon login failure this parameter will be returned. | | + | | message | [string] | Longer description of exception condition. | |
- | As noted, any condition that results in an unsuccessful | + | As noted, any condition that results in an unsuccessful |
Line 55: | Line 59: | ||
**Endpoint: | **Endpoint: | ||
- | < | + | < |
Line 67: | Line 71: | ||
<code json> | <code json> | ||
{ | { | ||
- | "user_name" : "sample1", | + | "checksum" : "1/l1YnJ1dnWFVbjEcUfp3IkBkPb1XBWhdC34T6nJ3YB859YuAtbhUUEG8Gcwimd1" |
- | " | + | |
} | } | ||
</ | </ | ||
- | **Sample Response:** | + | <color #7092be>Sample Response</ |
Status Code: 200 | Status Code: 200 | ||
- | or | ||
- | |||
- | Status Code: 500 (When an error occurs.) | ||
<code json> | <code json> | ||
{ | { | ||
- | "access_token": "534d4c30-28a0-48c8-a76d-bbd265d7a1ac" | + | "checksum_key": "315E7449-1A67-44A8-BCF4-7EB43666D54D" |
} | } | ||
</ | </ | ||
- | or | + | |
+ | **OR** | ||
+ | |||
+ | Status Code: 500 (When an error occurs.) | ||
+ | |||
+ | |||
+ | (example 1) | ||
<code json> | <code json> | ||
Line 93: | Line 100: | ||
" | " | ||
" | " | ||
- | " | + | " |
} | } | ||
} | } | ||
</ | </ | ||
- | or (example 2) | ||
- | < | + | <color # |
+ | |||
+ | Comments and sample code are provided for reference purposes only and are not intended to show all exception handling conditions and/or completed code blocks. | ||
+ | |||
+ | |||
+ | **Comment 1:** | ||
+ | |||
+ | The StoreChecksum web service requires a Base64 encoded SHA384 checksum to be provided as one of the parameters. | ||
+ | Following is a C# / .NET sample code snippet that shows how to generate a SHA3 checksum and convert the hash to a Base64 string: | ||
+ | |||
+ | |||
+ | {{page> | ||
+ | |||
+ | |||
+ | **Comment 2:** | ||
+ | |||
+ | Following is a C# / .NET sample code snippet that shows how to call the StoreChecksum web service. Your code will supply the values for the various parameters based on the following: | ||
+ | |||
+ | |||
+ | {{tablelayout? | ||
+ | ^ Parameter ^ Source ^ | ||
+ | | checksum | The Base64 encoded value of the SHA384 binary checksum that was calculated for the DOCUMENT string. | ||
+ | |||
+ | |||
+ | < | ||
+ | Public static void StoreChecksumExample() | ||
{ | { | ||
- | | + | // In this example I am picking up the checksum value I calculated from a |
- | "Code": "DatabaseError", | + | // form field in the sample application that is available on this Wiki. |
- | "Message": "Procedure or function ' | + | |
- | } | + | string strChecksumValue = tbChecksumValue.Text; |
+ | |||
+ | // The following value was obtained from your call to the Login web service. | ||
+ | |||
+ | string token = "ab34xyz3..."; | ||
+ | |||
+ | strURL = null; | ||
+ | client = null; | ||
+ | request = null; | ||
+ | response = null; | ||
+ | |||
+ | strURL = "https:// | ||
+ | |||
+ | client = new RestClient(strURL); | ||
+ | request = new RestRequest(Method.POST); | ||
+ | |||
+ | strParms = "{\n\t\" | ||
+ | strParms += strChecksumValue; | ||
+ | strParms += " | ||
+ | |||
+ | request.AddHeader(" | ||
+ | request.AddHeader("Content-Type", " | ||
+ | request.AddHeader(" | ||
+ | request.AddParameter("StoreChecksum", | ||
+ | |||
+ | response = client.Execute(request); | ||
+ | |||
+ | if (response.IsSuccessful) | ||
+ | { | ||
+ | var jsonResult2 = JsonConvert.DeserializeObject< | ||
+ | string strChecksumKey = jsonResult2.checksum_key; | ||
+ | |||
+ | // (Agents) Update the RequestChecksumValue property of the PRIA_DOCUMENT node with the value of strChecksumKey | ||
+ | // or | ||
+ | // (Counties) Update the ResponseChecksumValue property of the PRIA_DOCUMENT node with the value of strChecksumKey | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | var jsonResult2 = JsonConvert.DeserializeObject< | ||
+ | string str_ErrorCode = jsonResult2.ToString(); | ||
+ | |||
+ | // Do something with the error result | ||
+ | } | ||
} | } | ||
</ | </ | ||
- | <color # | + | **Comment 3:** |
- | Comments | + | Please note that before calling the CeRTNA web services you must establish the SecurityProtocol in your ServicePointManager. An example is shown below. The currently recommended protocol is Tls12. |
+ | |||
+ | <code C#> | ||
+ | public MainWindow() | ||
+ | { | ||
+ | InitializeComponent(); | ||
+ | System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | | ||
+ | SecurityProtocolType.Tls11 | | ||
+ | SecurityProtocolType.Tls12 | | ||
+ | SecurityProtocolType.Ssl3; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | **Comment 4:** | ||
+ | |||
+ | CeRTNA has posted a simple [[: | ||
+ | |||
+ | |||
+ | **Comment 5:** | ||
+ | |||
+ | A nice utility for experimenting with web service calls is POSTMAN. You can download a free version of POSTMAN from the following URL: https://www.getpostman.com/ | ||
guides/ws_store_checksum.1540575606.txt.gz · Last modified: by brett.zamora