Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Plugin version 1.4.1
Browse files Browse the repository at this point in the history
Added support for bitcode optimization in iOS

Support Cordova hook- no need to execute manually chooseArch_Windows.js
to attach the correct binaries for the architecture (x86/x64/arm)

Fixed build failure in Cordova-iOS debug configuration

Added Android x64 (64 bit) support

Supported Platforms: Android, iOS, Windows 8/8.1/10
  • Loading branch information
DanSIntel committed Feb 15, 2016
1 parent 1616c16 commit 7bdb068
Show file tree
Hide file tree
Showing 29 changed files with 131 additions and 69 deletions.
56 changes: 47 additions & 9 deletions README.md
Expand Up @@ -7,8 +7,9 @@ For example
- Establish a connection with remote server (E.g. XHR) using a protected channel. SSL/TLS establishment and usage will be done for you by the plugin

For more information please visit our API documentation @ https://software.intel.com/en-us/app-security-api/api
Additionally please see our demo application "MyPrivateNotes" https://software.intel.com/en-us/xdk/article/my-private-notes-sample

Additionally please see our demo applications:
- "MyPrivateNotes": https://software.intel.com/en-us/xdk/article/my-private-notes-sample
- "MyPrivatePhotos": https://software.intel.com/en-us/xdk/article/my-private-photos-sample

How to use the plugin
=====================
Expand Down Expand Up @@ -42,13 +43,6 @@ This example is for Android but applicable for iOS and Windows

Cordova 5.1.1 Windows build flow
================================
To overcome some gaps/issues with native library build in Windows we
provide a workaround script (ChooseArch_Windows.js) that you should use before
step 7 (build the project).
Copy the script from plugins\com.intel.security\src\windows to
platforms\windows and run it from platforms\windows directory.
Run the following command in a shell:
node.exe ChooseArch_Windows.js

It is recommended to upgrade the Cordova windows tools, please run "cordova platform update windows@4.2.0"

Expand All @@ -74,3 +68,47 @@ Cordova 5.1.1 Windows build flow
cordova compile windows --release --arch=x64 -- --appx=uap
for ARM --> cordova prepare windows --release --arch=ARM -- --appx=uap
cordova compile windows --release --arch=ARM -- --appx=uap


How to use the plugin from Visual Studio 2015 (Apache Cordova project):
=======================================================================

The following steps describes how to create a Cordova based app with App Security API for Windows:

1. Create a new Apache Cordova project from Visual Studio 2015 (Javascript projects type). If you don't have this type you probably not running the latest update of Visual Studio 2015.

2. Build the (empty) project but make sure you choose Windows (next to the run debug button). This creates the platform folder and specifically Windows platform.

3. Add App Security API plugin by:
a) double click on config.xml file
b) choose plugins tab
c) choose custom and copy the github link of the plugin: https://github.com/01org/AppSecurityApi

4. Add your web app content to the www folder.

5. Build the project, again make sure you build for Windows.

6. Open the CordovaApp.sln from ProjectRootDirectory/platforms/windows (Visual Studio 2015)

7. Build the project and now you have your app up and running using the plugin for Windows OS.



The following steps describes how to create a Cordova based app with App Security API for Android:

1. Create a new Apache Cordova project from Visual Studio 2015 (Javascript projects type). If you don't have this type you probably not running the latest update of Visual Studio 2015.

2. Add App Security API plugin by:
a) double click on config.xml file
b) choose plugins tab
c) choose custom and copy the github link of the plugin: https://github.com/01org/AppSecurityApi
3. Add your web app content to the www folder.

4. Build the project and make sure you choose Android (next to the run debug button). Now you have your app up and running using the plugin for Android OS.



Note: iOS has not been tested yet but according to the documentation it should be the same as Android with one change- make sure you choose iOS in the build.

12 changes: 12 additions & 0 deletions RELEASENOTES.md
@@ -1,3 +1,15 @@
1.4.1 (February, 2016)
Added support for bitcode optimization in iOS
Support Cordova hook- no need to execute manually chooseArch_Windows.js to attach the correct binaries for the architecture (x86/x64/arm)
Fixed build failure in Cordova-iOS debug configuration
Added Android x64 (64 bit) support
Supported Platforms: Android, iOS, Windows 8/8.1/10
The plugin was tested on:
- Android Intel and ARM devices
- iPhone ARM device
- Windows 8 Intel (x86, x64) devices
- Windows 8.1 ARM and Intel (x86, x64) devices
- Windows 10 Intel (x86, x64) devices
1.4.0 (December, 2015)
Added support for Windows 10
Secure Data createFromData and getWebOwners API webOwners parameter changed to an array of strings
Expand Down
41 changes: 41 additions & 0 deletions package.json
@@ -0,0 +1,41 @@
{
"name": "com.intel.security",
"version": "1.4.1",
"description": "App Security API plugin",
"cordova": {
"id": "com.intel.security",
"platforms": [
"android",
"ios",
"windows8",
"windows"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/01org/AppSecurityApi.git"
},
"keywords": [
"Intel",
"intel.security",
"intel.security.Services",
"Security Services",
"ecosystem:cordova",
"cordova-android",
"cordova-ios",
"cordova-windows8",
"cordova-windows",
"Intel XDK",
"encryption",
"cryptography",
"app",
"security",
"api"
],
"author": "Dan Shmul (Intel Corporation)",
"license": "SEE LICENSE IN LICENSE",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/01org/AppSecurityApi/issues"
}
}
6 changes: 4 additions & 2 deletions plugin.xml
Expand Up @@ -3,7 +3,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="com.intel.security"
version="1.4.0">
version="1.4.1">
<name>APP Security API</name>
<description>App Security API plugin</description>
<repo>https://github.com/01org/AppSecurityApi.git</repo>
Expand Down Expand Up @@ -39,6 +39,8 @@
<source-file src="src/android/armeabi" target-dir="libs" />
<source-file src="src/android/armeabi-v7a" target-dir="libs" />
<source-file src="src/android/x86" target-dir="libs" />
<source-file src="src/android/x86_64" target-dir="libs" />
<source-file src="src/android/arm64-v8a" target-dir="libs" />

</platform>

Expand Down Expand Up @@ -99,7 +101,7 @@
<js-module src="src/windows/servicesProxy.js" name="SecureProxy">
<merges target="" />
</js-module>

<hook type="after_prepare" src="src/windows/ChooseArch_Windows.js"/>

</platform>

Expand Down
Binary file added src/android/arm64-v8a/libSecurityServices.so
Binary file not shown.
Binary file modified src/android/armeabi-v7a/libSecurityServices.so
Binary file not shown.
Binary file modified src/android/armeabi/libSecurityServices.so
Binary file not shown.
Binary file modified src/android/x86/libSecurityServices.sb
Binary file not shown.
Binary file modified src/android/x86/libSecurityServices.so
Binary file not shown.
Binary file added src/android/x86_64/libSecurityServices.so
Binary file not shown.
Binary file modified src/ios/libkeyStore.a
Binary file not shown.
Binary file modified src/ios/libsService.a
Binary file not shown.
29 changes: 0 additions & 29 deletions src/ios/sService.m
Expand Up @@ -1490,35 +1490,6 @@ - (void) log:(CDVInvokedUrlCommand *)command
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void) unitTest:(CDVInvokedUrlCommand *)command
{
//Check input parameter. Probably not necessary
if( ![self checkArguments:command argNumber:1])
{
XSSLOG_BRIDGE(LOG_ERROR, "Exiting from %s, error 0x%x", __FUNCTION__, SSERVICE_ERROR_INTERNAL_ERROR.error_or_warn_code ) ;
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt: SSERVICE_ERROR_INTERNAL_ERROR.error_or_warn_code];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
return ;
}
[self.commandDelegate runInBackground:^{
sservice_result_t res = SSERVICE_SUCCESS_NOINFO ;

sservice_debug_unit_test() ;
CDVPluginResult *pluginResult = NULL ;
if( IS_FAILED(res) )
{
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
messageAsString:[NSString stringWithFormat:@"%d", res.error_or_warn_code]];
}
else
{
pluginResult = [ CDVPluginResult resultWithStatus: CDVCommandStatus_OK ];
}
// Execute sendPluginResult on this plugin's commandDelegate, passing in the ...
// ... instance of CDVPluginResult
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}];
}
#endif
@end

Expand Down
6 changes: 1 addition & 5 deletions src/ios/xss_api.h
Expand Up @@ -376,13 +376,9 @@ sservice_result_t sservice_securetransport_destroy
(
IN sservice_transport_handle_t handle
);

/** @} */
#ifndef NDEBUG
void sservice_debug_unit_test() ;
void sservice_log( sservice_log_source_t log_source, sservice_log_level_t log_level, char const *format_str, ... ) ;

#endif
/** @} */

#ifdef __cplusplus
}
Expand Down
3 changes: 1 addition & 2 deletions src/ios/xss_log.h
@@ -1,7 +1,6 @@
#ifndef SSERVICE_LOGGER_H
#define SSERVICE_LOGGER_H

#ifndef NDEBUG

/******************************************************************************
"Copyright (c) 2015-2015, Intel Corporation
Expand Down Expand Up @@ -59,6 +58,6 @@ typedef enum
LOG_SOURCE_RUNTIME = LOG_SOURCE_RUNTIME_VAL,
} sservice_log_source_t ;

#endif


#endif
2 changes: 2 additions & 0 deletions src/ios/xss_types.h
Expand Up @@ -40,7 +40,9 @@ ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF S
#endif
#define ALIGN1 ALIGN(1)

#ifndef UINT64_MAX
typedef unsigned long long uint64_t ;
#endif
typedef uint64_t sservice_handle_t ; /**< used to reference the object*/

#ifndef _UINT32_T
Expand Down
45 changes: 23 additions & 22 deletions src/windows/ChooseArch_Windows.js
Expand Up @@ -19,37 +19,38 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING N
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"
******************************************************************************/
var fs = require('fs');

var fs = require('fs');
var PLUGINS_DIR_IN_WINDOWS_PLATFORM='platforms/windows/plugins/com.intel.security';
// check if we already run the script
fs.access('plugins/com.intel.security/win8/x86/IntelSecurityServicesWRC.dll', fs.F_OK, function (err) {
fs.access(PLUGINS_DIR_IN_WINDOWS_PLATFORM+'/win8/x86/IntelSecurityServicesWRC.dll', fs.F_OK, function (err) {
if (err !== null){
// file not exist we can run the script
try { fs.mkdirSync("plugins"); } catch(e) {}
try { fs.mkdirSync("plugins/com.intel.security/"); } catch(e) {}
try { fs.mkdirSync("plugins/com.intel.security/win8"); } catch(e) {}
try { fs.mkdirSync("plugins/com.intel.security/win10"); } catch(e) {}
try { fs.mkdirSync("plugins/com.intel.security/win8/x86"); } catch(e) {}
try { fs.mkdirSync("plugins/com.intel.security/win8/x64"); } catch(e) {}
try { fs.mkdirSync("plugins/com.intel.security/win8/arm"); } catch(e) {}
try { fs.mkdirSync("plugins/com.intel.security/win10/x86"); } catch(e) {}
try { fs.mkdirSync("plugins/com.intel.security/win10/x64"); } catch(e) {}
try { fs.mkdirSync("plugins/com.intel.security/win10/arm"); } catch(e) {}
// file not exist we can run the script
try { fs.mkdirSync("platforms/windows/plugins"); } catch(e) {}
try { fs.mkdirSync(PLUGINS_DIR_IN_WINDOWS_PLATFORM); } catch(e) {}
try { fs.mkdirSync(PLUGINS_DIR_IN_WINDOWS_PLATFORM+"/win8"); } catch(e) {}
try { fs.mkdirSync(PLUGINS_DIR_IN_WINDOWS_PLATFORM+"/win10"); } catch(e) {}
try { fs.mkdirSync(PLUGINS_DIR_IN_WINDOWS_PLATFORM+"/win8/x86"); } catch(e) {}
try { fs.mkdirSync(PLUGINS_DIR_IN_WINDOWS_PLATFORM+"/win8/x64"); } catch(e) {}
try { fs.mkdirSync(PLUGINS_DIR_IN_WINDOWS_PLATFORM+"/win8/arm"); } catch(e) {}
try { fs.mkdirSync(PLUGINS_DIR_IN_WINDOWS_PLATFORM+"/win10/x86"); } catch(e) {}
try { fs.mkdirSync(PLUGINS_DIR_IN_WINDOWS_PLATFORM+"/win10/x64"); } catch(e) {}
try { fs.mkdirSync(PLUGINS_DIR_IN_WINDOWS_PLATFORM+"/win10/arm"); } catch(e) {}

copyFilesIntoProject();
var solutionFile2012 = 'CordovaApp.vs2012.sln';
var solutionFile2015 = 'CordovaApp.sln';
var projectFile80 = 'CordovaApp.Windows80.jsproj';
var projectFile10 = 'CordovaApp.Windows10.jsproj';
var projectFile81 = 'CordovaApp.Windows.jsproj';
var solutionFile2012 = 'platforms/windows/CordovaApp.vs2012.sln';
var solutionFile2015 = 'platforms/windows/CordovaApp.sln';
var projectFile80 = 'platforms/windows/CordovaApp.Windows80.jsproj';
var projectFile10 = 'platforms/windows/CordovaApp.Windows10.jsproj';
var projectFile81 = 'platforms/windows/CordovaApp.Windows.jsproj';

defineArchSLN(solutionFile2012);
defineArchSLN(solutionFile2015);
fixProjectFile8(projectFile80);
fixProjectFile81(projectFile81);
fixProjectFile10(projectFile10);

console.log("Fixed!");
console.log("Fixed!");

} else {
// file exist we should not run the script
Expand All @@ -68,8 +69,8 @@ function copyFilesIntoProject() {
var archNames = ['x86', 'x64', 'arm'];
for (var k = 0; k < winNames.length; k++) {
for (var j = 0; j < archNames.length; j++) {
var srcPath = '../../plugins/com.intel.security/src/windows/' + winNames[k] + '/' + archNames[j] + '/';
var dstPath = 'plugins/com.intel.security/' + winNames[k] + '/' + archNames[j] + '/';
var srcPath = 'plugins/com.intel.security/src/windows/'+winNames[k] + '/' + archNames[j] + '/';
var dstPath = PLUGINS_DIR_IN_WINDOWS_PLATFORM +'/'+ winNames[k] + '/' + archNames[j] + '/';
var dllFilesName = ['IntelSecurityServicesWRC.dll', 'IntelSecurityServicesWRC.winmd'];

for (var i = 0; i < dllFilesName.length; i++) {
Expand Down
Binary file modified src/windows/Win10/ARM/IntelSecurityServicesWRC.dll
Binary file not shown.
Binary file modified src/windows/Win10/ARM/IntelSecurityServicesWRC.winmd
Binary file not shown.
Binary file modified src/windows/Win10/x64/IntelSecurityServicesWRC.dll
Binary file not shown.
Binary file modified src/windows/Win10/x64/IntelSecurityServicesWRC.winmd
Binary file not shown.
Binary file modified src/windows/Win10/x86/IntelSecurityServicesWRC.dll
Binary file not shown.
Binary file modified src/windows/Win10/x86/IntelSecurityServicesWRC.winmd
Binary file not shown.
Binary file modified src/windows/Win8/ARM/IntelSecurityServicesWRC.dll
Binary file not shown.
Binary file modified src/windows/Win8/ARM/IntelSecurityServicesWRC.winmd
Binary file not shown.
Binary file modified src/windows/Win8/x64/IntelSecurityServicesWRC.dll
Binary file not shown.
Binary file modified src/windows/Win8/x64/IntelSecurityServicesWRC.winmd
Binary file not shown.
Binary file modified src/windows/Win8/x86/IntelSecurityServicesWRC.dll
Binary file not shown.
Binary file modified src/windows/Win8/x86/IntelSecurityServicesWRC.winmd
Binary file not shown.

0 comments on commit 7bdb068

Please sign in to comment.