Skip to content

Commit e0f6a42

Browse files
committed
Adds README.md
1 parent ecd7c9b commit e0f6a42

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

README.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
## openssl-ane ![License MIT](http://img.shields.io/badge/license-MIT-lightgray.svg)
2+
3+
![iOS](https://img.shields.io/badge/iOS-12.0-blue) ![macOS](https://img.shields.io/badge/macOS-10.9-888888) ![macOS](https://img.shields.io/badge/Windows-XP-42AD42)
4+
5+
[AIR Native Extension](http://www.adobe.com/devnet/air/native-extensions-for-air.html) for OpenSSL library that exposes several cryptographic functions of it to AIR.
6+
7+
## Table of Contents
8+
9+
- [Setup](#setup)
10+
- [Usage](#usage)
11+
- [API](#api)
12+
- [Shared Instance](#shared-instance)
13+
- [Hashing](#hashing)
14+
- [RSA](#rsa)
15+
- [AES](#aes)
16+
- [Certificates](#certificates)
17+
- [Utils](#utils)
18+
- [Contributors](#contributors)
19+
20+
### Setup
21+
22+
1. Download [com.github.airext.OpenSSL.ane](https://github.com/airext/openssl/releases) ANE and [add it as dependencies](http://bit.ly/2xTSJry) to your project. Optionally you may include corresponded `com.github.airext.OpenSSL.swc` library to your project.
23+
2. Edit your [Application Descriptor](http://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff1.html) file with registering new native extensions like this:
24+
```xml
25+
<extensions>
26+
<extensionID>com.github.airext.OpenSSL</extensionID>
27+
</extensions>
28+
```
29+
Set iOS minimum version to 12.0 in iPhone InfoAdditions:
30+
```xml
31+
<iPhone>
32+
<!-- A list of plist key/value pairs to be added to the application Info.plist -->
33+
<InfoAdditions>
34+
<![CDATA[
35+
<key>MinimumOSVersion</key>
36+
<string>12.0</string>
37+
]]>
38+
</InfoAdditions>
39+
</iPhone>
40+
```
41+
42+
### Usage
43+
44+
### API
45+
46+
Full documentation can be found [here](https://airext.github.io/openssl/)
47+
48+
#### Shared Instance
49+
50+
Use `OpenSSL.shared` to obtain singleton instance of OpenSSL class.
51+
52+
#### Hashing
53+
* `OpenSSL.shared.sha256Compute(array: ByteArray): ByteArray` hashes the specified `array` using SHA256. Result is the UTF bytes of the hash in hex format.
54+
* `OpenSSL.shared.hmacCompute(data: ByteArray, key: ByteArray): ByteArray` hashes the specified **data** using the specified **key** and SHA256. Result is the UTF bytes of the hash in hex format
55+
* `OpenSSL.shared.pbkdf2Compute(password: ByteArray, salt: ByteArray, iterations: int, length: int): ByteArray` hashes the specified **password** along with the specified **salt**, over the number of **iteraions**. The resulting hash will have the specified **length**. The hashing function used is SHA256. Result is the UTF bytes of the hash in hex format.
56+
57+
#### RSA
58+
* `OpenSSL.shared.rsaEncrypt(data: ByteArray, publicKey: ByteArray): ByteArray` encrypts **data** using the specified **publicKey**. Where **data** must be maximum 245 bytes and **publicKey** is the UTF bytes of the public key in PEM format. The public key can be obtained from a certificate using extractPublicKey() function. Result is an encrypted byte array.
59+
* `OpenSSL.shared.rsaDecrypt(data: ByteArray, privateKey: ByteArray): ByteArray` decrypts **data** using the specified **privateKey**. Where **privateKey** is the UTF bytes of the private key in PEM format. Result is a decrypted byte array.
60+
61+
#### AES
62+
* `OpenSSL.shared.aesEncrypt(data: ByteArray, key: ByteArray, iv: ByteArray): ByteArray` encrypts **data** with the specified **key** and initialization vector **iv**. Where **key** must be 256bit and **iv** must be 128bit. Result is an encrypted byte array.
63+
* `OpenSSL.shared.aesDecrypt(data: ByteArray, key: ByteArray, iv: ByteArray): ByteArray` decrypts **data** with the specified **key** and initialization vector **iv**. Where **key** must be 256bit and **iv** must be 128bit. Result is a decrypted byte array.
64+
65+
#### Certificates
66+
* `OpenSSL.shared.extractPublicKey(certificate: ByteArray): ByteArray` extracts the public key of the specified **certificate**. Where **certificate** is the UTF bytes of the certificate in PEM format. Result is the UTF bytes of the private key in PEM format.
67+
* `OpenSSL.shared.parseCertificate(certificate: ByteArray): ByteArray` extracts the subject of the specified **certificate**. Where **certificate** is the UTF bytes of the certificate in PEM format. Result is the UTF bytes of the certificate subject.
68+
* `OpenSSL.shared.parseCertificateSerial(certificate: ByteArray) : ByteArray` extracts the serial of the specified **certificate**. Where **certificate** is the UTF bytes of the certificate in PEM format. Result is the UTF bytes of the certificate serial in decimal (big integer) format, written as a string.
69+
* `OpenSSL.shared.verifyCertificate(rootCA: ByteArray, certificate: ByteArray): Boolean` verifies the specified **certificate** against the specified **rootCA** certificate. Where **rootCA** is the UTF bytes of the CA (Certification Authority) certificate in PEM format and **certificate** is the UTF bytes of the certificate to be verified in PEM format. Returns true if the **certificate** was issued by **rootCA**.
70+
71+
#### Utils
72+
* `OpenSSL.shared.getOpenSSLVersion()` returns the version of the OpenSSL library used
73+
74+
### Contributors
75+
* https://github.com/htmiel
76+
* Zeljko Janketic
77+
* https://github.com/rozd

0 commit comments

Comments
 (0)