Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 22 additions & 3 deletions .hgignore → .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
(^|/)*\.xcuserdatad($|/)

syntax: glob
xcuserdata/

# Backup files left behind by Emacs
*~
Expand All @@ -11,6 +9,7 @@ syntax: glob

# Temp files used by vim
.*.swp
tags

# XCode
*.xcworkspace*
Expand Down Expand Up @@ -39,6 +38,7 @@ Desktop DF
*.so
*.ncb
*.sdf
*.opensdf
*.suo
*.idb
*.pdb
Expand All @@ -59,3 +59,22 @@ mac/plugin_openssl.dylib

win32/Debug
win32/Release

plugin-openssl-android.tgz
plugin-openssl-iphone-sim.tgz
plugin-openssl-iphone.tgz
plugin-openssl-osx.tgz
plugin-openssl-tvos-sim.tgz
plugin-openssl-tvos.tgz
plugin-openssl-win32.zip

tests/cert.pem
tests/key.pem
tvos/build_tvos_openssl
ios/build_ios_openssl
osx/build_macos_openssl

win32/.vs
# keep for publish
!win32/Release/plugin_*.dll
win32/build_win32_openssl
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "sdk-lua-openssl"]
path = sdk-lua-openssl
url = ../lua-openssl
[submodule "sdk-luasocket"]
path = sdk-luasocket
url = ../submodule-luasocket
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Corona/Encryption/AndroidResources/res/values/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#e2e2e2</color>
</resources>
Binary file added Corona/Encryption/Icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 108 additions & 0 deletions Corona/Encryption/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-40.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-58.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-87.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-80.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-120.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-180.png",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-152.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-167.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-1024.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Corona/Encryption/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
31 changes: 31 additions & 0 deletions Corona/Encryption/LaunchScreen.storyboardc/designable.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
35 changes: 35 additions & 0 deletions Corona/Encryption/build.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
settings =
{
iphone =
{
plist =
{
CFBundleIconFile = "Icon.png",
CFBundleIconFiles = {
"Icon.png",
"Icon@2x.png",
"Icon-72.png",
},
},
},

androidPermissions =
{
"android.permission.WRITE_EXTERNAL_STORAGE"
},

plugins =
{
-- key is the name passed to Lua's 'require()'
["plugin.openssl"] =
{
-- required
publisherId = "com.coronalabs",
},
},

android =
{
minSdkVersion = 16
}
}
11 changes: 11 additions & 0 deletions Corona/Encryption/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- config.lua

application =
{
content =
{
width = 320,
height = 480,
scale = "letterbox" -- zoom to fill screen, possibly cropping edges
},
}
9 changes: 9 additions & 0 deletions Corona/Encryption/extern.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- This is here to make sure "require" works correctly
--
extern = {}

function extern.printVersion()
print "-- This is module \"extern\" version 1.0 --"
end

return extern
82 changes: 82 additions & 0 deletions Corona/Encryption/main.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
--------------------------------------------------------------------------------
-- Sample code is MIT licensed, see https://coronalabs.com/links/code/license
-- Copyright (C) 2016 Corona Labs Inc. All Rights Reserved.
--------------------------------------------------------------------------------

--
-- Demonstrates simple but secure AES256 encryption
--

local json = require "json"

local g = display.newGroup()

local msg = "OpenSSL Encryption"

local title = display.newText( msg, 0, 0, native.systemFont, 30 )
title.anchorY = 0
title.x = display.contentWidth / 2
title.y = 10
title:setFillColor( 233/255, 137/255, 38/255 )

g:insert(title)

local log = native.newTextBox( display.actualContentWidth / 2, (display.actualContentHeight - 100) / 2, display.actualContentWidth-10, 400)
log.anchorY = 0
log.size = 10
log.x = display.contentWidth / 2
log.y = title.y + title.height + 10

g:insert(log)

local origPrint = Runtime._G.print

Runtime._G.print = function(...)
log.text = log.text .. "\n" .. string.format("%.5g: ", system.getTimer())

for _, k in ipairs({...}) do
log.text = log.text .. " " .. tostring(k)
end

origPrint(...)
end

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

local is_opensslv3 = true
local good, openssl = pcall( require, "plugin.opensslv3" )
if good == false then
is_opensslv3 = false
print("WARNING: v3 not found, pcall require message is:", tostring(openssl))
print("Now require plugin.openssl")
openssl = require("plugin.openssl")
end

local lua_openssl_version, lua_version, openssl_version = openssl.version()
print( "lua-openssl version: " .. lua_openssl_version, lua_version, openssl_version )

local aes256cbc = nil

if is_opensslv3 then
aes256cbc = openssl.cipher.get( "aes-256-cbc" )
else
aes256cbc = openssl.get_cipher( "aes-256-cbc" )
end

print("openssl:" ,json.prettify(openssl))

-- from Solar2D engine, not plugin.openssl
local mime = require( "mime" )

local testString = "Test String"
local testKey = "TestKey@#$"

local encryptedData = mime.b64( aes256cbc:encrypt( testString, testKey ) )
local decryptedData = aes256cbc:decrypt( mime.unb64( encryptedData ), testKey )

print( "Test String: " .. testString )
print("")
print( "Encrypted Text: " .. encryptedData )
print("")
print( "Decrypted Text: " .. decryptedData )

Binary file added Corona/Encryption/world.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Corona/General/AndroidResources/res/values/values.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#e2e2e2</color>
</resources>
Binary file removed Corona/General/Icon-72.png
Diff not rendered.
Binary file removed Corona/General/Icon-hdpi.png
Diff not rendered.
Binary file removed Corona/General/Icon-ldpi.png
Diff not rendered.
Binary file removed Corona/General/Icon-mdpi.png
Diff not rendered.
Binary file modified Corona/General/Icon.png
100644 → 100755
Binary file removed Corona/General/Icon@2x.png
Diff not rendered.
Loading