Software Archive
Read-only legacy content

intel xdk SSL (API Secure

sergio_c_2
Beginner
4,372 Views

Hello,

I'm developing an application that communicates with a server through an SSL tunnel. For this, I use the API of intel xdk called API Secure. Specifically these functions:
https://software.intel.com/en-us/node/560364

The problem I have, is  when i create the instance with the function: "intel.security.secureTransport.open (success, fail, options);" 
https://software.intel.com/es-es/node/560365

This function can receive 4 options. My problem comes when I want to include the server key. I don´t know what is the format of the server key.
¿I have to put the path?, ¿I have to put the serverkey.pem like a string?

If you could help me I would be very grateful, sorry for my English

Thank You So Much

0 Kudos
25 Replies
sergio_c_2
Beginner
768 Views

Hello again,

Everything was fine using the "Secure API" plugin in my application. My app worked great. But today when I went to build my app again, after making some changes, it has appeared to me the following error message:

errorAPI.png

At first I thought it might be due to the changes I had made in my app, so undid these changes and tried to rebuild the app, but the error went on.

The last thing I thought was to create a new project, a blank app, and add the "secure API" plugin. But when I try to build this application blank, the error continues.

So it seems a problem of this plugin, it can be due?
Can you help me fix it?

Thank you very much again

A greeting

Sergio Cosio del Olmo

0 Kudos
Ohad_B_Intel
Employee
768 Views

Hi Sergio,

Thank you for notice that, it seems that XDK build system fails to build Android application that includes App Security API plugin.

We have informed the Intel XDK team regarding this error and expecting to see fix soon, I will keep you posted.

Thank,  

    Ohad

 

0 Kudos
Ohad_B_Intel
Employee
768 Views

Hi Sergio,

The issue was in the Intel XDK build system configuration, it was fixed.

Please try again and update me if you find any error.

Thanks,  

    Ohad

0 Kudos
Numery_Z_
Beginner
768 Views

Hi All,

I am using the following code as a link in my android app.

<a href='https://192.168.50.48:443/trcz0.html'>Click Here</a>

But it showing message like "GET https://192.168.50.48/trcz0.html net::ERR_INSECURE_RESPONSE" 

I am using self sign certificate. And Android device. Whats the update now? Can I use self sign certificate in the SIMULATE or Build. 

 

I also use the following code in the javascript. But it showing me the error of  "Uncaught ReferenceError: intel is not defined"

---------------------------------------------------------------------------------------------------------------------------------------------

$(document).on("click", ".uib_w_1", function(evt)
    {
        alert("Hello");
         var options = { url: "https://192.168.50.48/trcz0.html",  
                serverKey: "-----BEGIN PUBLIC KEY-----\
                       MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA7a+Bmtfz2x5AsuHATE5s\
                       lU+Q+4rma592T7dodLpfLSYx9x3XLpk6eem9ESwDnBHi93a7pXoEHQCeMHlya/WC\
                       0Uwvl6FpYd69gJn+LMc5Tw0E966snZkkJ6zkJG2aKc9IROC2RBGJxhFb8jTpmSxy\
                       M76qwCh3Wng3VrhhBfOPebRMJSP7AStJj5mN+gSB0ILNVvw+6LCFc/NBByLtfKHx\
                       9o+2yvPJaPWhii8GQSNRsvKKTZ6H9ww2rGQ10tp6VUKo9UTnIfhnUgesPKAqYXeT\
                       l2y20J7sjHcNYhciIJ9xAQMx5lbKuhLqMBUSPGybixBDi+aFV7mm7KC03tPbmI+e\
                       ZlxBElxKkIyYq3we8YEWBSBOiRF+WWMgPf2KWPaUyIWNdCtO/NNrC1LwioLzQPtI\
                       nHOs6UMjkNmfuPgr6FeIoSsZ0DHhd11EuG2Su1cYXP+7dxDe0IYTN2G1Aqj+nMl1\
                       EYmCfE0nKc1HOa3d5rumN4JdawnFZQ48HRFeOc4pxGT87ynitVBwVcxXa+lvfiSP\
                       hBiGPw6gUJgF57q0bjVmvi7iqOlQXK0xU/d7MhzcIVIF33tzi3XGyJCQlyjN8w0U\
                       IaA71ljmCKmCmEX43Hw7Qy76uBv3vD52CxXOHQiXeV9roDB69rCOf6YoVD3F5/EJ\
                       bimclhAgx1nt4SJRtyYOAi0CAwEAAQ==\
                       -----END PUBLIC KEY-----" };

        intel.security.secureTransport.open(
        function (instanceID) {
            alert("success callback is called, instance id is: "+instanceID);
        },
        function (errorMsg) {
            alert("failed callback is called, error is: "+errorMsg);
        },
        options);
        }

------------------------------------------------------------------------------------------------------------------------------------

 

Kindly Help

Thanks

0 Kudos
Vandana_K_
Beginner
768 Views

Hi, I am facing issues while doing cert pinning in android via com-intel-security-cordova-plugin. When i pin a public key of a cert (used facebook's in below sample), i am getting below error:

07-12 21:43:36.354 5850-5850/com.vandana.intelssl I/chromium: [INFO:CONSOLE(77)] "Fail, error: [object Object] error code is: 33, error message is: Communication authentication error", source: file:///android_asset/www/js/index.js (77)

Any idea how to fix it, please?

Below is my code:

var app = {
    // Application Constructor
    initialize: function() {
        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
    },

    // deviceready Event Handler
    //
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function() {
        this.receivedEvent('deviceready');

        // TODO change server PK

            var publicKey = "-----BEGIN PUBLIC KEY-----\n" +
            "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxEjiWVGgjCgy6GjTUTZJ\n" +
            "AFgPJ5ybGKVvCzG7yDKB2A2gLhFD3oEwiikVI2glBcSoPq6Yy2sOpZJWb2uchDVy\n" +
            "djqy/6UrwL9vjZ4vAicRsI0A+ftVpyQZhCb2r50OnI6Fy8rpYQc0B8DP2XEq8RE3\n" +
            "nrG7cFt80e+vygNv+FvV/8QwAAZlDNMCiCUEMtQ3ZHh8XybVIhVVYefrPY7GLec7\n" +
            "UbbgP0coaJE9utVIZxLIOzD+3dpCL0+/f6H2BkQLeVi5qB3+fyVsHqkHDKHnjG18\n" +
            "nrJUR9xcNFNO9OnhZK/JwT3kyECnd7mv7wE5JG9o3nsMapic+OkLWUTUNZYRzeyj\n" +
            "3QIDAQAB\n" +
            "-----END PUBLIC KEY-----\n";

        console.log('Public Key: ' + publicKey);

        alert('Trying to connect to Facebook');
        
        // create the Transport Secure instance
        intel.security.secureTransport.open( {url: "https://www.facebook.com", serverKey: publicKey} )

        // send the request
        .then (function (transportInstanceID) {
                // send the HTTPS request
                return intel.security.secureTransport.sendRequest( {instanceID: transportInstanceID, requestBody: "data to send"} );
        })

        // process the response
        .then (function(response) {
            // assign response HTTP status
            var responseHttpStatus = response.responseHttpStatus;

            // assign response body
            var responseBody = response.responseBody;

            // assign response header
            var responseHeader = response.responseHeader;

            // now we have the following items:
            // the response status in 'responseHttpStatus'
            // the response body in 'responseBody'
            // the response header in 'responseHeader'

            // we can use those in our code.
            doSomethingAfterReceiveWithKeyPinning(response);
        })

        .catch (function(error) {
            console.log("Fail, error: "+ error + " error code is: " + error.code + ", error message is: " + error.message);
            alert("Fail, error: "+ error + " error code is: " + error.code + ", error message is: " + error.message);
        });

    },

    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event: ' + id);
    }
};

app.initialize();

 

0 Kudos
Reply