Skip to content
This repository has been archived by the owner on Jun 25, 2019. It is now read-only.

Commit

Permalink
Merge pull request #5 from ajp8164/master
Browse files Browse the repository at this point in the history
Rename to bch
  • Loading branch information
Andy Phillipson committed Sep 29, 2017
2 parents 57f0d3a + 367b269 commit 1dec11e
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ node_modules


tests.js
bcc-ecies.js
bcc-ecies.min.js
bch-ecies.js
bch-ecies.min.js
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Contributing

Please see [CONTRIBUTING.md](https://github.com/owstack/bcc/blob/master/CONTRIBUTING.md) on the main bcc repo.
Please see [CONTRIBUTING.md](https://github.com/owstack/bch/blob/master/CONTRIBUTING.md) on the main bch repo.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Bcc ECIES
Bch ECIES
======

[![NPM Package](https://img.shields.io/npm/v/bcc-ecies.svg?style=flat-square)](https://www.npmjs.org/package/bcc-ecies)
[![Build Status](https://img.shields.io/travis/owstack/bcc-ecies.svg?branch=master&style=flat-square)](https://travis-ci.org/owstack/bcc-ecies)
[![Coverage Status](https://img.shields.io/coveralls/owstack/bcc-ecies.svg?style=flat-square)](https://coveralls.io/r/owstack/bcc-ecies)
[![NPM Package](https://img.shields.io/npm/v/bch-ecies.svg?style=flat-square)](https://www.npmjs.org/package/bch-ecies)
[![Build Status](https://img.shields.io/travis/owstack/bch-ecies.svg?branch=master&style=flat-square)](https://travis-ci.org/owstack/bch-ecies)
[![Coverage Status](https://img.shields.io/coveralls/owstack/bch-ecies.svg?style=flat-square)](https://coveralls.io/r/owstack/bch-ecies)

A module for [bcc][bcc] that implements the [Elliptic Curve Integrated Encryption Scheme (ECIES)](http://en.wikipedia.org/wiki/Integrated_Encryption_Scheme). Uses ECIES symmetric key negotiation from public keys to encrypt arbitrarily long data streams.
A module for [bch][bch] that implements the [Elliptic Curve Integrated Encryption Scheme (ECIES)](http://en.wikipedia.org/wiki/Integrated_Encryption_Scheme). Uses ECIES symmetric key negotiation from public keys to encrypt arbitrarily long data streams.

See [the main bcc repo](https://github.com/owstack/bcc) or the [bcc guide on ECIES](http://bcc.io/guide/module/ecies/index.html) for more information.
See [the main bch repo](https://github.com/owstack/bch) or the [bch guide on ECIES](http://bch.io/guide/module/ecies/index.html) for more information.

Credit to [@ryanxcharles][ryan] for the original implementation.

Expand Down Expand Up @@ -40,10 +40,10 @@ var decrypted = bob

## Contributing

See [CONTRIBUTING.md](https://github.com/owstack/bcc/blob/master/CONTRIBUTING.md) on the main bcc repo for information about how to contribute.
See [CONTRIBUTING.md](https://github.com/owstack/bch/blob/master/CONTRIBUTING.md) on the main bch repo for information about how to contribute.

## License

Code released under [the MIT license](https://github.com/owstack/bcc/blob/master/LICENSE).
Code released under [the MIT license](https://github.com/owstack/bch/blob/master/LICENSE).

Copyright 2017 Open Wallet Stack.
10 changes: 5 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "bcc-ecies",
"main": "./bcc-ecies.min.js",
"name": "bch-ecies",
"main": "./bch-ecies.min.js",
"version": "0.0.1",
"homepage": "https://github.com/owstack/bcc-ecies",
"description": "ECIES support for Bcc Node.",
"homepage": "https://github.com/owstack/bch-ecies",
"description": "ECIES support for Bch Node.",
"moduleType": [
"globals"
],
"keywords": [
"bitcoin",
"bcc",
"bch",
"btc",
"satoshi",
"ecies"
Expand Down
14 changes: 7 additions & 7 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# ECIES
Implements [Elliptic Curve Integrated Encryption Scheme (ECIES)](http://en.wikipedia.org/wiki/Integrated_Encryption_Scheme), which is a public key encryption system that performs bulk encryption on data using a symmetric cipher and a random key.

For more information refer to the [bcc-ecies](https://github.com/owstack/bcc-ecies) github repo.
For more information refer to the [bch-ecies](https://github.com/owstack/bch-ecies) github repo.

## Installation
ECIES is implemented as a separate module and you must add it to your dependencies:

For node projects:

```bash
npm install bcc-ecies --save
npm install bch-ecies --save
```

For client-side projects:

```bash
bower install bcc-ecies --save
bower install bch-ecies --save
```

## Example

```javascript
var bccLib = require('bcc-lib');
var ECIES = require('bcc-ecies');
var bchLib = require('bch-lib');
var ECIES = require('bch-ecies');

var alicePrivateKey = new bccLib.PrivateKey();
var bobPrivateKey = new bccLib.PrivateKey();
var alicePrivateKey = new bchLib.PrivateKey();
var bobPrivateKey = new bchLib.PrivateKey();

var data = new Buffer('The is a raw data example');

Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'use strict';
var owsTasks = require('ows-build');
owsTasks('bcc', 'ecies');
owsTasks('bch', 'ecies');
4 changes: 2 additions & 2 deletions lib/aes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var bccLib = require('bcc-lib');
var $ = bccLib.util.preconditions;
var bchLib = require('bch-lib');
var $ = bchLib.util.preconditions;
var aes = require('aes');

var AES = function AES() {};
Expand Down
8 changes: 4 additions & 4 deletions lib/aescbc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';

var bccLib = require('bcc-lib');
var bchLib = require('bch-lib');

var $ = bccLib.util.preconditions;
var $ = bchLib.util.preconditions;
var AES = require('./aes');
var CBC = require('./cbc');
var Random = bccLib.crypto.Random;
var Hash = bccLib.crypto.Hash;
var Random = bchLib.crypto.Random;
var Hash = bchLib.crypto.Hash;

// Symmetric encryption with AES and CBC convenience class
var AESCBC = function AESCBC() {};
Expand Down
4 changes: 2 additions & 2 deletions lib/cbc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

var errors = require('./errors');
var bccLib = require('bcc-lib');
var $ = bccLib.util.preconditions;
var bchLib = require('bch-lib');
var $ = bchLib.util.preconditions;

// Cipher Block Chaining
// http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher-block_chaining_.28CBC.29
Expand Down
10 changes: 5 additions & 5 deletions lib/ecies.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

var bccLib = require('bcc-lib');
var bchLib = require('bch-lib');

var PublicKey = bccLib.PublicKey;
var Hash = bccLib.crypto.Hash;
var Random = bccLib.crypto.Random;
var $ = bccLib.util.preconditions;
var PublicKey = bchLib.PublicKey;
var Hash = bchLib.crypto.Hash;
var Random = bchLib.crypto.Random;
var $ = bchLib.util.preconditions;


var AESCBC = require('./aescbc');
Expand Down
4 changes: 2 additions & 2 deletions lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

var spec = {
name: 'ECIES',
message: 'Internal Error on bcc-ecies Module {0}',
message: 'Internal Error on bch-ecies Module {0}',
errors: [{
name: 'InvalidPadding',
message: 'Invalid padding: {0}'
}]
};


module.exports = require('bcc-lib').errors.extend(spec);
module.exports = require('bch-lib').errors.extend(spec);

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bcc-ecies",
"name": "bch-ecies",
"version": "0.0.1",
"description": "ECIES support for Bcc Node.",
"description": "ECIES support for Bch Node.",
"main": "index.js",
"directories": {
"test": "test"
Expand All @@ -14,24 +14,24 @@
},
"repository": {
"type": "git",
"url": "https://github.com/owstack/bcc-ecies.git"
"url": "https://github.com/owstack/bch-ecies.git"
},
"keywords": [
"bitcoin",
"bcc",
"bch",
"ecies",
"crypto",
"cryptography",
"encryption"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/owstack/bcc-ecies/issues"
"url": "https://github.com/owstack/bch-ecies/issues"
},
"homepage": "https://github.com/owstack/bcc-ecies",
"homepage": "https://github.com/owstack/bch-ecies",
"dependencies": {
"aes": "^0.1.0",
"bcc-lib": "https://github.com/owstack/bcc-lib"
"bch-lib": "https://github.com/owstack/bch-lib"
},
"devDependencies": {
"assert": "^1.1.2",
Expand Down
16 changes: 8 additions & 8 deletions test/ecies.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
var ECIES = require('../');

var should = require('chai').should();
var bccLib = require('bcc-lib');
var PrivateKey = bccLib.PrivateKey;
var bchLib = require('bch-lib');
var PrivateKey = bchLib.PrivateKey;

var aliceKey = new PrivateKey('L1Ejc5dAigm5XrM3mNptMEsNnHzS7s51YxU7J61ewGshZTKkbmzJ');
var bobKey = new PrivateKey('KxfxrUXSMjJQcb3JgnaaA6MqsrKQ1nBSxvhuigdKRyFiEm6BZDgG');
Expand Down Expand Up @@ -119,11 +119,11 @@ describe('ECIES', function() {
});

it('errors', function() {
should.exist(bccLib.errors.ECIES);
should.exist(bchLib.errors.ECIES);
});

it('correctly fails if trying to decrypt a bad message', function() {
var encrypted = bccLib.util.buffer.copy(encBuf);
var encrypted = bchLib.util.buffer.copy(encBuf);
encrypted[encrypted.length - 1] = 2;
(function() {
return bob.decrypt(encrypted);
Expand All @@ -134,12 +134,12 @@ describe('ECIES', function() {
var secret = 'test';

// test uncompressed
var alicePrivateKey = new bccLib.PrivateKey.fromObject({
var alicePrivateKey = new bchLib.PrivateKey.fromObject({
bn: '1fa76f9c799ca3a51e2c7c901d3ba8e24f6d870beccf8df56faf30120b38f360',
compressed: false,
network: 'livenet'
});
var alicePublicKey = new bccLib.PublicKey.fromPrivateKey(alicePrivateKey); // alicePrivateKey.publicKey
var alicePublicKey = new bchLib.PublicKey.fromPrivateKey(alicePrivateKey); // alicePrivateKey.publicKey
alicePrivateKey.compressed.should.equal(false);

var cypher1 = ECIES().privateKey(alicePrivateKey).publicKey(alicePublicKey);
Expand All @@ -154,12 +154,12 @@ describe('ECIES', function() {
var secret = 'test';

// test compressed
var alicePrivateKey = new bccLib.PrivateKey.fromObject({
var alicePrivateKey = new bchLib.PrivateKey.fromObject({
bn: '1fa76f9c799ca3a51e2c7c901d3ba8e24f6d870beccf8df56faf30120b38f360',
compressed: true,
network: 'livenet'
});
var alicePublicKey = new bccLib.PublicKey.fromPrivateKey(alicePrivateKey); // alicePrivateKey.publicKey
var alicePublicKey = new bchLib.PublicKey.fromPrivateKey(alicePrivateKey); // alicePrivateKey.publicKey
alicePrivateKey.compressed.should.equal(true);

var cypher1 = ECIES().privateKey(alicePrivateKey).publicKey(alicePublicKey);
Expand Down

0 comments on commit 1dec11e

Please sign in to comment.