AcroSuite Cipher

FREEMIUM
By Samurai | Updated 23 days ago | Tools
Popularity

5.4 / 10

Latency

1,751ms

Service Level

100%

Health Check

N/A

Back to All Tutorials (2)

Create a test web page for AcroSuite Cipher

AcroSuite Cipher provides some RSA Cipher/Decipher RESTful APIs, they may be called from Web site, Server side and Native application.
Of course, it is required to support RESTful APIs in HTTP/HTTPS. In the meantime, you are assumed to have some knowledge above PKI/RSA.
You can find a lot of code snippet by Java/JavaScript/Node.js/C/C#/GO/Kotlin/Objective-C/PHP/Python/R/Powershell/Ruby/Swift/R/Shell in the following page.
https://api.rakuten.net/AcroChannel/api/acrosuite-cipher

Here, I paste my HTML/JavaScript(jQuery) for you to have a test.
The whole test page is here.
https://mars.acrochannel.com/intro/en/suite_en_rakuten.html#cipher

##HTML

<table class="color-table">
<thead><th>Name</th><th>Type</th><th>URL</th><th>JsonParam</th><th>Header/QueryParam</th></thead>
<tbody>

<tr>
    <td align="middle" valign="top" rowspan="3"><button id="btn_newRsaKey">Generate<br>RSAKey</button></td>
    <td align="middle" valign="top" id="type_newRsaKey">get</td>
    <td align="left" valign="top">
    <textarea name="url_newRsaKey" id="url_newRsaKey" cols="50" rows=4>https://acrosuite-cipher.p.rapidapi.com/v0_1/CstService/tools/cipher/rsakey</textarea></td>
    <td align="left" valign="top">    </td>
    <td align="left" valign="top">x-rapidapi-host<br>
    <textarea name="newRsaKey_x-rapidapi-host" id="newRsaKey_x-rapidapi-host" cols="50" rows=1>acrosuite-cipher.p.rapidapi.com</textarea><br>
    x-rapidapi-key<br>
    <textarea name="newRsaKey_x-rapidapi-key" id="newRsaKey_x-rapidapi-key" cols="50" rows=2>[your rapidapi-key]</textarea>
    </td>
</tr>
<tr>
    <td colspan="4"><pre id="">Generate Public and Private key pair of RSA.</pre></td>
</tr>
<tr>
    <td colspan="4"><pre id="result_newRsaKey"></pre></td>
</tr>
<tr>
    <td align="middle" valign="top" rowspan="3"><button id="btn_newSignature">Generate<br>Signature</button></td>
    <td align="middle" valign="top" id="type_newSignature">post</td>
    <td align="left" valign="top">
    <textarea name="url_newSignature" id="url_newSignature" cols="50" rows=4>https://acrosuite-cipher.p.rapidapi.com/v0_1/CstService/tools/cipher/signature</textarea></td>
    <td align="left" valign="top"><textarea name="json_newSignature" id="json_newSignature" cols="50" rows=10>
    {
        "publicKey": "H4sIAAAAAA...AA",
        "privateKey": "H4sIAAAAA...A==",
        "signName": "User2002_1"
    }</textarea>    </td>
    <td align="left" valign="top">x-rapidapi-host<br>
    <textarea name="newSignature_x-rapidapi-host" id="newSignature_x-rapidapi-host" cols="50" rows=1>acrosuite-cipher.p.rapidapi.com</textarea><br>
    x-rapidapi-key<br>
    <textarea name="newSignature_x-rapidapi-key" id="newSignature_x-rapidapi-key" cols="50" rows=2>[your rapidapi-key]</textarea>
    </td>
</tr>
<tr>
    <td colspan="4"><pre id="">Generate Digital Signature by RSA Key. You need prepare Public/Private Key in advance.</pre></td>
</tr>
<tr>
    <td colspan="4"><pre id="result_newSignature"></pre></td>
</tr>
<tr>
    <td align="middle" valign="top" rowspan="3"><button id="btn_checkSignature">Verify<br>Signature</button></td>
    <td align="middle" valign="top" id="type_checkSignature">post</td>
    <td align="left" valign="top">
    <textarea name="url_checkSignature" id="url_checkSignature" cols="50" rows=4>https://acrosuite-cipher.p.rapidapi.com/v0_1/CstService/tools/cipher/isvalidsignature</textarea></td>
    <td align="left" valign="top"><textarea name="json_checkSignature" id="json_checkSignature" cols="50" rows=10>
    {
        "publicKey": "H4sIAAAA...AA",
        "signature": "H4sIAA...AA==",
        "signDT": "2020-04-27 17:12:31.519",
        "signHash": "lmTcHazlUGh7IY8qS5J1VQ",
        "signName": "User2002_1"
    }</textarea>    </td>
    <td align="left" valign="top">x-rapidapi-host<br>
    <textarea name="checkSignature_x-rapidapi-host" id="checkSignature_x-rapidapi-host" cols="50" rows=1>acrosuite-cipher.p.rapidapi.com</textarea><br>
    x-rapidapi-key<br>
    <textarea name="checkSignature_x-rapidapi-key" id="checkSignature_x-rapidapi-key" cols="50" rows=2>[your rapidapi-key]</textarea>
    </td>
</tr>
<tr>
    <td colspan="4"><pre id="">Do Validity Check for Digital Signature by RSA.</pre></td>
</tr>
<tr>
    <td colspan="4"><pre id="result_checkSignature"></pre></td>
</tr>
<tr>
    <td align="middle" valign="top" rowspan="3"><button id="btn_RsaCipher">Encrypt<br>Decrypt</button></td>
    <td align="middle" valign="top" id="type_RsaCipher">post</td>
    <td align="left" valign="top">
    <textarea name="url_RsaCipher" id="url_RsaCipher" cols="50" rows=4>https://acrosuite-cipher.p.rapidapi.com/v0_1/CstService/tools/cipher/message</textarea></td>
    <td align="left" valign="top"><textarea name="json_RsaCipher" id="json_RsaCipher" cols="50" rows=10>
    {
       "cipherKey": "H4sIAAAA...AA==",
       "keyType": 1,
       "message": "123456"
    }</textarea>    </td>
    <td align="left" valign="top">x-rapidapi-host<br>
    <textarea name="RsaCipher_x-rapidapi-host" id="RsaCipher_x-rapidapi-host" cols="50" rows=1>acrosuite-cipher.p.rapidapi.com</textarea><br>
    x-rapidapi-key<br>
    <textarea name="RsaCipher_x-rapidapi-key" id="RsaCipher_x-rapidapi-key" cols="50" rows=2>[your rapidapi-key]</textarea>
    <br>
    <textarea name="qry_RsaCipher" id="qry_RsaCipher" cols="50" rows=1>cipherType=</textarea>    </td>
</tr>
<tr>
    <td colspan="4"><pre id="">Encrypt or Decrypt text messages by Public/Private Key of RSA.</pre></td>
</tr>
<tr>
    <td colspan="4"><pre id="result_RsaCipher"></pre></td>
</tr>
</tbody>
</table>

##JavaScript(jQuery)

    $('#btn_newRsaKey').on('click',function(){
        $.ajax({
            url:$('#url_newRsaKey').val(),
            type:$('#type_newRsaKey').text(),
            headers: {
                'Content-Type': 'application/json',
              'x-rapidapi-host': $('#newRsaKey_x-rapidapi-host').val(),
              'x-rapidapi-key': $('#newRsaKey_x-rapidapi-key').val()
            },
            xhrFields: { withCredentials: true },
            crossDomain: true,
            dataType: 'json',
            async: false,
            timeout: 10000,
            statusCode: {
               200: function(data){
                    console.log(data);
               },
               404: function(){
                    console.log("404");
               },
               500: function(data){
                    console.log(data);
               }
            }
        })
        .done( (data,textStatus,jqXHR) => {
            try {
                $("#result_newRsaKey").text(JSON.stringify(data, null, "    "));
            } catch (e) {
                $("#result_newRsaKey").text("Parse Error");
            }
        })
        .fail( (data,jqXHR, textStatus, errorThrown) => {
            $("#result_newRsaKey").html(textStatus);
        })
        .always( (data) => {
            //$("#out6").html("complete");
        });
    });

    $('#btn_newSignature').on('click',function(){
        $.ajax({
            url:$('#url_newSignature').val(),
            type:$('#type_newSignature').text(),
            headers: {
                'Content-Type': 'application/json',
              'x-rapidapi-host': $('#newSignature_x-rapidapi-host').val(),
              'x-rapidapi-key': $('#newSignature_x-rapidapi-key').val()
            },
            xhrFields: { withCredentials: true },
            crossDomain: true,
            dataType: 'json',
            async: false,
            timeout: 10000,
            data:$('#json_newSignature').val(),
            statusCode: {
               200: function(data){
                    console.log(data);
               },
               404: function(){
                    console.log("404");
               },
               500: function(data){
                    console.log(data);
               }
            }
        })
        .done( (data,textStatus,jqXHR) => {
            try {
                $("#result_newSignature").text(JSON.stringify(data, null, "    "));
            } catch (e) {
                $("#result_newSignature").text("Parse Error");
            }
        })
        .fail( (data,jqXHR, textStatus, errorThrown) => {
            $("#result_newSignature").html(textStatus);
        })
        .always( (data) => {
            //$("#out6").html("complete");
        });
    });

    $('#btn_checkSignature').on('click',function(){
        $.ajax({
            url:$('#url_checkSignature').val(),
            type:$('#type_checkSignature').text(),
            headers: {
                'Content-Type': 'application/json',
              'x-rapidapi-host': $('#checkSignature_x-rapidapi-host').val(),
              'x-rapidapi-key': $('#checkSignature_x-rapidapi-key').val()
            },
            xhrFields: { withCredentials: true },
            crossDomain: true,
            dataType: 'json',
            async: false,
            timeout: 10000,
            data:$('#json_checkSignature').val(),
            statusCode: {
               200: function(data){
                    console.log(data);
               },
               404: function(){
                    console.log("404");
               },
               500: function(data){
                    console.log(data);
               }
            }
        })
        .done( (data,textStatus,jqXHR) => {
            try {
                $("#result_checkSignature").text(JSON.stringify(data, null, "    "));
            } catch (e) {
                $("#result_checkSignature").text("Parse Error");
            }
        })
        .fail( (data,jqXHR, textStatus, errorThrown) => {
            $("#result_checkSignature").html(textStatus);
        })
        .always( (data) => {
            //$("#out6").html("complete");
        });
    });

    $('#btn_RsaCipher').on('click',function(){
        $.ajax({
            url:$('#url_RsaCipher').val() + '?' + $('#qry_RsaCipher').val(),
            type:$('#type_RsaCipher').text(),
            headers: {
              'Content-Type': 'application/json',
              'x-rapidapi-host': $('#RsaCipher_x-rapidapi-host').val(),
              'x-rapidapi-key': $('#RsaCipher_x-rapidapi-key').val()
            },
            xhrFields: { withCredentials: true },
            crossDomain: true,
            dataType: 'json',
            async: false,
            timeout: 10000,
            data:$('#json_RsaCipher').val(),
            statusCode: {
               200: function(data){
                    console.log(data);
               },
               404: function(){
                    console.log("404");
               },
               500: function(data){
                    console.log(data);
               }
            }
        })
        .done( (data,textStatus,jqXHR) => {
            try {
                $("#result_RsaCipher").text(JSON.stringify(data, null, "    "));
            } catch (e) {
                $("#result_RsaCipher").text("Parse Error");
            }
        })
        .fail( (data,jqXHR, textStatus, errorThrown) => {
            $("#result_RsaCipher").html(textStatus);
        })
        .always( (data) => {
            //$("#out6").html("complete");
        });
    });

Good luck!