You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@milagro.apache.org by km...@apache.org on 2019/06/25 14:49:00 UTC
[incubator-milagro-crypto-js] branch issue7 updated: added docker
This is an automated email from the ASF dual-hosted git repository.
kmccusker pushed a commit to branch issue7
in repository https://gitbox.apache.org/repos/asf/incubator-milagro-crypto-js.git
The following commit(s) were added to refs/heads/issue7 by this push:
new 233c526 added docker
233c526 is described below
commit 233c526b7963de9112b6f99263f778e970b69143
Author: Kealan McCusker <ke...@gmail.com>
AuthorDate: Tue Jun 25 15:48:45 2019 +0100
added docker
---
.dockerignore | 6 ++++++
Dockerfile | 31 +++++++++++++++++++++++++++++++
README.md | 28 +++++++++++++++++++++++++++-
package.json | 16 ++++++++--------
src/bls192.js | 2 +-
src/bls256.js | 2 +-
6 files changed, 74 insertions(+), 11 deletions(-)
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..4f8b41a
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,6 @@
+.git
+node_modules/
+coverage
+.nyc_output
+package-lock.json
+*~
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100755
index 0000000..7127680
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,31 @@
+# Dockerfile
+#
+# @author Kealan McCusker <ke...@gmail.com>
+# ------------------------------------------------------------------------------
+
+# ------------------------------------------------------------------------------
+# NOTES:
+#
+# To create the image execute:
+# docker build -t mcjs:builder .
+#
+# To run tests:
+# docker run --rm mcjs:builder
+#
+# To login to container:
+# docker run -it --rm mcjs:builder bash
+# ------------------------------------------------------------------------------
+
+FROM node:8
+
+MAINTAINER kealanmccusker@gmail.com
+
+WORKDIR /root
+
+ADD . /root
+
+RUN npm install
+
+CMD npm test
+
+
diff --git a/README.md b/README.md
index 2f9d191..381aa3e 100644
--- a/README.md
+++ b/README.md
@@ -46,7 +46,9 @@ npm test
```
## Quick Start
+
#### Elliptic Curves
+
Suppose you want to implement ECDH with NIST256 elliptic curve. First you need
to initialize the context:
@@ -55,39 +57,54 @@ var CTX = require("milagro-crypto-js");
var ctx = new CTX("NIST256");
```
+
then you can call the functions as follows:
+
```
ctx.ECDH.KEY_PAIR_GENERATE(...);
ctx.ECDH.ECPSVDP_DH(...);
```
+
If you need to use more than one elliptic curve in the same script you only
need to initialize two different contexts, for example
+
```
var ctx1 = new CTX("NIST256");
var ctx2 = new CTX("C25519");
```
+
The following is the list of all elliptic curves supported by MCJS
+
```
['ED25519', 'C25519', 'SECP256K1', 'NIST256', 'NIST384', 'BRAINPOOL', 'ANSSI', 'HIFIVE', 'GOLDILOCKS', 'C41417', 'NIST521', 'NUMS256W', 'NUMS256E', 'NUMS384W', 'NUMS384E', 'NUMS512W', 'NUMS512E', 'FP256BN', 'FP512BN', 'BN254', 'BN254CX', 'BLS383', 'BLS24', 'BLS48', 'BLS381', 'BLS461'];
```
+
#### RSA
+
This library supports also RSA encryption/decryption and RSA signature. The following is a quick example on how to use RSA. First initialize the context
+
```
var CTX = require("milagro-crypto-js");
var ctx = new CTX("RSA2048");
```
then you can call the RSA functions as follows:
+
```
ctx.RSA.ENCRYPT(...);
ctx.RSA.DECRYPT(...);
```
+
The following is the list of all the RSA security level supported by *MCJS*
+
```
['RSA2048','RSA3072','RSA4096'];
```
+
#### Other functions
+
MCJS supports SHA256, SHA384, SHA512, AES-GCM encryption and Marsaglia & Zaman random number generator. Those functions are contained in every context initialized with RSA or with an elliptic curve. If you want to create a context supporting only those general functions then initialize it with no parameter as follows:
+
```
var CTX = require("milagro-crypto-js");
@@ -103,11 +120,20 @@ var ctx = new CTX();
node ./examples/node/example_ECC_NIST256.js
```
-#### Browsers
+## Browsers
The library source code is browser compatible. The browser examples are locates
in `./examples/browser`.
+## Docker
+
+The tests can be run using Docker:
+
+```
+docker build -t mcjs:builder .
+docker run --rm mcjs:builder
+```
+
## Contributors
The following people have contributed to milagro-crypto-js
diff --git a/package.json b/package.json
index 1894815..9ccd1cf 100644
--- a/package.json
+++ b/package.json
@@ -30,14 +30,14 @@
},
"homepage": "https://github.com/apache/incubator-milagro-crypto-js#readme",
"devDependencies": {
- "chai": "^3.5.0",
- "coveralls": "^3.0.2",
- "eslint": "^4.12.1",
- "istanbul": "^0.4.5",
- "mocha": "^5.2.0",
- "mocha-text-cov": "^0.1.1",
- "nyc": "^11.0.2",
- "mocha-parallel-tests": "^2.0.4"
+ "chai": "latest",
+ "coveralls": "latest",
+ "eslint": "latest",
+ "istanbul": "latest",
+ "mocha": "latest",
+ "mocha-text-cov": "latest",
+ "nyc": "latest",
+ "mocha-parallel-tests": "latest"
},
"nyc": {
"include": [
diff --git a/src/bls192.js b/src/bls192.js
index e00d37b..a2e3e01 100644
--- a/src/bls192.js
+++ b/src/bls192.js
@@ -113,7 +113,7 @@ var BLS192 = function(ctx) {
if (v.isunity())
return this.BLS_OK;
return this.BLS_FAIL;
- }
+ },
/* R=R1+R2 in group G1 */
add_G1(R1, R2, R) {
diff --git a/src/bls256.js b/src/bls256.js
index 3c7fac6..f48f4e9 100644
--- a/src/bls256.js
+++ b/src/bls256.js
@@ -114,7 +114,7 @@ var BLS256 = function(ctx) {
if (v.isunity())
return this.BLS_OK;
return this.BLS_FAIL;
- }
+ },
/* R=R1+R2 in group G1 */