Add files missed in last commit
This commit is contained in:
parent
3680695a69
commit
9f4e6e7ebb
Gruntfile.jspackage.json
src
config
crypto
index.jskeyring
packet
literal.jspacket.jspublic_key.jspublic_key_encrypted_session_key.jssecret_key.jssignature.jssym_encrypted_integrity_protected.jsuser_attribute.jsuserid.js
type
util.jstest
107
Gruntfile.js
107
Gruntfile.js
|
@ -6,42 +6,23 @@ module.exports = function(grunt) {
|
|||
browserify: {
|
||||
openpgp_nodebug: {
|
||||
files: {
|
||||
'resources/openpgp_nodebug.js': []
|
||||
'dist/openpgp_nodebug.js': []
|
||||
},
|
||||
options: {
|
||||
alias: './src/:openpgp',
|
||||
alias: [ './src/:openpgp' ],
|
||||
external: [ 'crypto', 'node-localstorage' ]
|
||||
}
|
||||
},
|
||||
openpgp: {
|
||||
files: {
|
||||
'resources/openpgp.js': []
|
||||
'dist/openpgp.js': []
|
||||
},
|
||||
options: {
|
||||
debug: true,
|
||||
alias: './src/:openpgp',
|
||||
alias: [ './src/:openpgp' ],
|
||||
external: [ 'crypto', 'node-localstorage' ]
|
||||
}
|
||||
},
|
||||
keyring_nodebug: {
|
||||
files: {
|
||||
'resources/keyring_nodebug.js': []
|
||||
},
|
||||
options: {
|
||||
alias: './src/keyring/:keyring',
|
||||
external: [ 'openpgp', 'node-localstorage' ]
|
||||
}
|
||||
},
|
||||
keyring: {
|
||||
files: {
|
||||
'resources/keyring.js': []
|
||||
},
|
||||
options: {
|
||||
debug: true,
|
||||
alias: './src/keyring/:keyring',
|
||||
external: [ 'openpgp', 'node-localstorage' ]
|
||||
}
|
||||
},
|
||||
unittests: {
|
||||
files: {
|
||||
'test/lib/unittests-bundle.js': []
|
||||
|
@ -49,22 +30,22 @@ module.exports = function(grunt) {
|
|||
options: {
|
||||
debug: true,
|
||||
alias: './test/unittests.js:unittests',
|
||||
external: [ 'openpgp', 'keyring', 'node-localstorage' ]
|
||||
external: [ 'openpgp' ]
|
||||
}
|
||||
}
|
||||
},
|
||||
replace : {
|
||||
replace: {
|
||||
openpgpjs: {
|
||||
src: ['resources/openpgp.js'],
|
||||
dest: ['resources/openpgp.js'],
|
||||
src: ['dist/openpgp.js'],
|
||||
dest: ['dist/openpgp.js'],
|
||||
replacements: [{
|
||||
from: /OpenPGP.js VERSION/g,
|
||||
to: 'OpenPGP.js v<%= pkg.version %>.<%= grunt.template.today("yyyymmdd") %>'
|
||||
}]
|
||||
},
|
||||
openpgpjs_nodebug: {
|
||||
src: ['resources/openpgp_nodebug.js'],
|
||||
dest: ['resources/openpgp_nodebug.js'],
|
||||
src: ['dist/openpgp_nodebug.js'],
|
||||
dest: ['dist/openpgp_nodebug.js'],
|
||||
replacements: [{
|
||||
from: /OpenPGP.js VERSION/g,
|
||||
to: 'OpenPGP.js v<%= pkg.version %>.<%= grunt.template.today("yyyymmdd") %>'
|
||||
|
@ -74,8 +55,7 @@ module.exports = function(grunt) {
|
|||
uglify: {
|
||||
openpgpjs: {
|
||||
files: {
|
||||
"resources/openpgp.min.js" : [ "resources/openpgp_nodebug.js" ],
|
||||
"resources/keyring.min.js" : [ "resources/keyring_nodebug.js" ]
|
||||
'dist/openpgp.min.js' : [ 'dist/openpgp_nodebug.js' ]
|
||||
}
|
||||
},
|
||||
options: {
|
||||
|
@ -83,11 +63,9 @@ module.exports = function(grunt) {
|
|||
'<%= grunt.template.today("yyyy-mm-dd") %> */'
|
||||
}
|
||||
},
|
||||
prepare_install: {
|
||||
},
|
||||
jsbeautifier : {
|
||||
files : ["src/**/*.js"],
|
||||
options : {
|
||||
jsbeautifier: {
|
||||
files: ['src/**/*.js'],
|
||||
options: {
|
||||
indent_size: 2,
|
||||
preserve_newlines: true,
|
||||
keep_array_indentation: false,
|
||||
|
@ -95,20 +73,27 @@ module.exports = function(grunt) {
|
|||
wrap_line_length: 120
|
||||
}
|
||||
},
|
||||
jshint : {
|
||||
all : ["src/**/*.js"]
|
||||
jshint: {
|
||||
all: ['src/**/*.js']
|
||||
},
|
||||
jsdoc : {
|
||||
dist : {
|
||||
src: ["README.md", "src"],
|
||||
jsdoc: {
|
||||
dist: {
|
||||
src: ['README.md', 'src'],
|
||||
options: {
|
||||
destination: "doc",
|
||||
destination: 'doc',
|
||||
recurse: true,
|
||||
template: "jsdoc.template"
|
||||
template: 'jsdoc.template'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
mochaTest: {
|
||||
unittests: {
|
||||
options: {
|
||||
reporter: 'spec'
|
||||
},
|
||||
src: [ 'test/unittests.js' ]
|
||||
}
|
||||
},
|
||||
copy: {
|
||||
npm: {
|
||||
expand: true,
|
||||
|
@ -120,24 +105,23 @@ module.exports = function(grunt) {
|
|||
}
|
||||
});
|
||||
|
||||
// Load the plugin that provides the "uglify" task.
|
||||
// Load the plugin(s)
|
||||
grunt.loadNpmTasks('grunt-browserify');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-text-replace');
|
||||
grunt.loadNpmTasks('grunt-prepare-install');
|
||||
grunt.loadNpmTasks('grunt-jsbeautifier');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-jsdoc');
|
||||
grunt.loadNpmTasks('grunt-mocha-test');
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
|
||||
grunt.registerTask('default', 'Build OpenPGP.js', function() {
|
||||
grunt.task.run(['browserify', 'replace', 'uglify']);
|
||||
grunt.task.run(['browserify', 'replace', 'uglify', 'npm_pack']);
|
||||
//TODO jshint is not run because of too many discovered issues, once these are addressed it should autorun
|
||||
grunt.log.ok('Before Submitting a Pull Request please also run `grunt jshint`.');
|
||||
});
|
||||
grunt.registerTask('documentation', ['jsdoc']);
|
||||
|
||||
// Load the plugin(s)
|
||||
grunt.loadNpmTasks('grunt-contrib-copy');
|
||||
grunt.registerTask('documentation', ['jsdoc']);
|
||||
|
||||
// Alias the `mocha_phantomjs` task to run `mocha-phantomjs`
|
||||
grunt.registerTask('mocha_phantomjs', 'mocha-phantomjs', function () {
|
||||
|
@ -149,6 +133,25 @@ module.exports = function(grunt) {
|
|||
mocha.stderr.pipe(process.stderr);
|
||||
});
|
||||
|
||||
// Test/Dev tasks
|
||||
grunt.registerTask('test', ['copy', 'mocha_phantomjs']);
|
||||
// Alias the `npm_pack` task to run `npm pack`
|
||||
grunt.registerTask('npm_pack', 'npm pack', function () {
|
||||
var done = this.async();
|
||||
var npm = require('child_process').exec('npm pack ../', { cwd: 'dist'}, function (err, stdout) {
|
||||
var package = stdout;
|
||||
if (err === null) {
|
||||
var install = require('child_process').exec('npm install dist/' + package, function (err) {
|
||||
done(err);
|
||||
});
|
||||
install.stdout.pipe(process.stdout);
|
||||
install.stderr.pipe(process.stderr);
|
||||
} else {
|
||||
done(err);
|
||||
}
|
||||
});
|
||||
npm.stdout.pipe(process.stdout);
|
||||
npm.stderr.pipe(process.stderr);
|
||||
});
|
||||
|
||||
// Test/Dev tasks
|
||||
grunt.registerTask('test', ['copy', 'mocha_phantomjs', 'mochaTest']);
|
||||
};
|
||||
|
|
17
package.json
17
package.json
|
@ -4,11 +4,14 @@
|
|||
"engines": {
|
||||
"node": ">=0.8"
|
||||
},
|
||||
"main": "src/index.js",
|
||||
"directories": {
|
||||
"lib": "src"
|
||||
},
|
||||
"main": "src/index.js",
|
||||
"files": [ "src" ],
|
||||
"files": [
|
||||
"src",
|
||||
"test"
|
||||
],
|
||||
"scripts": {
|
||||
"pretest": "grunt",
|
||||
"test": "grunt test"
|
||||
|
@ -26,6 +29,14 @@
|
|||
"grunt-text-replace": "*",
|
||||
"grunt-jsbeautifier": "*",
|
||||
"grunt-contrib-jshint": "*",
|
||||
"grunt-jsdoc": "*"
|
||||
"grunt-jsdoc": "*",
|
||||
"grunt-mocha-test": "~0.8.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"node-localstorage": "~0.3.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/openpgpjs/openpgpjs"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,5 +43,7 @@ module.exports = {
|
|||
versionstring: "OpenPGP.js VERSION",
|
||||
commentstring: "http://openpgpjs.org",
|
||||
|
||||
node_store: './openpgp.store',
|
||||
|
||||
debug: false
|
||||
};
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
/**
|
||||
* @see module:config/config
|
||||
* @module config
|
||||
*/
|
||||
module.exports = require('./config.js');
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
* @module crypto/cfb
|
||||
*/
|
||||
|
||||
var util = require('../util'),
|
||||
var util = require('../util.js'),
|
||||
cipher = require('./cipher');
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* @module crypto/cipher/aes
|
||||
*/
|
||||
|
||||
var util = require('../../util');
|
||||
var util = require('../../util.js');
|
||||
|
||||
// The round constants used in subkey expansion
|
||||
var Rcon = [
|
||||
|
|
|
@ -391,7 +391,7 @@ Blowfish.prototype.init = function(key) {
|
|||
}
|
||||
};
|
||||
|
||||
var util = require('../../util');
|
||||
var util = require('../../util.js');
|
||||
|
||||
// added by Recurity Labs
|
||||
|
||||
|
|
|
@ -591,7 +591,7 @@ function openpgp_symenc_cast5() {
|
|||
0x04f19130, 0xba6e4ec0, 0x99265164, 0x1ee7230d, 0x50b2ad80, 0xeaee6801, 0x8db2a283, 0xea8bf59e);
|
||||
|
||||
}
|
||||
var util = require('../../util');
|
||||
var util = require('../../util.js');
|
||||
|
||||
function cast5(key) {
|
||||
this.cast5 = new openpgp_symenc_cast5();
|
||||
|
|
|
@ -361,7 +361,7 @@ function des_removePadding(message, padding) {
|
|||
}
|
||||
|
||||
|
||||
var util = require('../../util');
|
||||
var util = require('../../util.js');
|
||||
|
||||
// added by Recurity Labs
|
||||
|
||||
|
|
|
@ -354,7 +354,7 @@ function createTwofish() {
|
|||
};
|
||||
}
|
||||
|
||||
var util = require('../../util');
|
||||
var util = require('../../util.js');
|
||||
|
||||
// added by Recurity Labs
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* @module crypto/hash/md5
|
||||
*/
|
||||
|
||||
var util = require('../../util');
|
||||
var util = require('../../util.js');
|
||||
|
||||
/**
|
||||
* MD5 hash
|
||||
|
|
|
@ -49,7 +49,7 @@ hash_headers[11] = [0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01,
|
|||
|
||||
var crypto = require('./crypto.js'),
|
||||
random = require('./random.js'),
|
||||
util = require('../util'),
|
||||
util = require('../util.js'),
|
||||
BigInteger = require('./public_key/jsbn.js'),
|
||||
hash = require('./hash');
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
var BigInteger = require('./jsbn.js'),
|
||||
random = require('../random.js'),
|
||||
hashModule = require('../hash'),
|
||||
util = require('../../util'),
|
||||
util = require('../../util.js'),
|
||||
config = require('../../config');
|
||||
|
||||
function DSA() {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
var BigInteger = require('./jsbn.js'),
|
||||
random = require('../random.js'),
|
||||
util = require('../../util');
|
||||
util = require('../../util.js');
|
||||
|
||||
function Elgamal() {
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* @module crypto/public_key/jsbn
|
||||
*/
|
||||
|
||||
var util = require('../../util');
|
||||
var util = require('../../util.js');
|
||||
|
||||
// Basic JavaScript BN library - subset useful for RSA encryption.
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
var BigInteger = require('./jsbn.js'),
|
||||
util = require('../../util'),
|
||||
util = require('../../util.js'),
|
||||
random = require('../random.js');
|
||||
|
||||
function SecureRandom() {
|
||||
|
|
|
@ -27,7 +27,7 @@ var nodeCrypto = null;
|
|||
|
||||
if (typeof window === undefined) {}
|
||||
try {
|
||||
crypto = require('crypto');
|
||||
nodeCrypto = require('crypto');
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ module.exports = {
|
|||
this.getRandomValues(buf);
|
||||
var bits = ((to - from)).toString(2).length;
|
||||
while ((buf[0] & (Math.pow(2, bits) - 1)) > (to - from))
|
||||
window.crypto.getRandomValues(buf);
|
||||
this.getRandomValues(buf);
|
||||
return from + (Math.abs(buf[0] & (Math.pow(2, bits) - 1)));
|
||||
},
|
||||
|
||||
|
@ -84,7 +84,7 @@ module.exports = {
|
|||
try {
|
||||
window.crypto.getRandomValues(buf);
|
||||
} catch (e) {
|
||||
var bytes = crypto.randomBytes(4);
|
||||
var bytes = nodeCrypto.randomBytes(4);
|
||||
buf[0] = (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3];
|
||||
}
|
||||
},
|
||||
|
|
52
src/index.js
52
src/index.js
|
@ -1,39 +1,67 @@
|
|||
|
||||
module.exports = require('./openpgp.js');
|
||||
|
||||
/**
|
||||
* @see module:key
|
||||
* @name module:openpgp.key
|
||||
*/
|
||||
module.exports.key = require('./key.js');
|
||||
/**
|
||||
* @see module:message
|
||||
* @name module:openpgp.message
|
||||
*/
|
||||
module.exports.message = require('./message.js');
|
||||
/**
|
||||
* @see module:cleartext
|
||||
* @name module:openpgp.cleartext
|
||||
*/
|
||||
module.exports.cleartext = require('./cleartext.js');
|
||||
/**
|
||||
* @see module:util/util
|
||||
* @module util
|
||||
* @see module:util
|
||||
* @name module:openpgp.util
|
||||
*/
|
||||
module.exports.util = require('./util.js');
|
||||
/**
|
||||
* @see module:packet
|
||||
* @name module:openpgp.packet
|
||||
*/
|
||||
module.exports.util = require('./util/util.js');
|
||||
module.exports.packet = require('./packet');
|
||||
/**
|
||||
* @see module:type/mpi
|
||||
* @module mpi
|
||||
* @name module:openpgp.MPI
|
||||
*/
|
||||
module.exports.mpi = require('./type/mpi.js');
|
||||
module.exports.MPI = require('./type/mpi.js');
|
||||
/**
|
||||
* @see module:type/s2k
|
||||
* @module s2k
|
||||
* @name module:openpgp.S2K
|
||||
*/
|
||||
module.exports.s2k = require('./type/s2k.js');
|
||||
module.exports.S2K = require('./type/s2k.js');
|
||||
/**
|
||||
* @see module:type/keyid
|
||||
* @module keyid
|
||||
* @name module:openpgp.Keyid
|
||||
*/
|
||||
module.exports.keyid = require('./type/keyid.js');
|
||||
module.exports.Keyid = require('./type/keyid.js');
|
||||
/**
|
||||
* @see module:encoding/armor
|
||||
* @module armor
|
||||
* @name module:openpgp.armor
|
||||
*/
|
||||
module.exports.armor = require('./encoding/armor.js');
|
||||
/**
|
||||
* @see module:enums
|
||||
* @name module:openpgp.enums
|
||||
*/
|
||||
module.exports.enums = require('./enums.js');
|
||||
/**
|
||||
* @see module:config/config
|
||||
* @module config
|
||||
* @name module:openpgp.config
|
||||
*/
|
||||
module.exports.config = require('./config/config.js');
|
||||
/**
|
||||
* @see module:crypto
|
||||
* @name module:openpgp.crypto
|
||||
*/
|
||||
module.exports.crypto = require('./crypto');
|
||||
/**
|
||||
* @see module:keyring
|
||||
* @name module:openpgp.Keyring
|
||||
*/
|
||||
module.exports.Keyring = require('./keyring');
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
/**
|
||||
* @see module:keyring/keyring
|
||||
* @module keyring
|
||||
*/
|
||||
module.exports = require('./keyring.js');
|
||||
module.exports.localstore = require('./localstore.js');
|
||||
|
|
|
@ -39,7 +39,7 @@ LocalStore.prototype.load = function () {
|
|||
}
|
||||
|
||||
if (storage === null) {
|
||||
storage = new (require('node-localstorage').LocalStorage)('./keyring.store');
|
||||
storage = new (require('node-localstorage').LocalStorage)(openpgp.config.node_store);
|
||||
}
|
||||
var armoredKeys = JSON.parse(storage.getItem("armoredKeys"));
|
||||
var keys = [];
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
module.exports = Literal;
|
||||
|
||||
var util = require('../util'),
|
||||
var util = require('../util.js'),
|
||||
enums = require('../enums.js');
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
var enums = require('../enums.js'),
|
||||
util = require('../util');
|
||||
util = require('../util.js');
|
||||
|
||||
module.exports = {
|
||||
readSimpleLength: function(bytes) {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
module.exports = PublicKey;
|
||||
|
||||
var util = require('../util'),
|
||||
var util = require('../util.js'),
|
||||
type_mpi = require('../type/mpi.js'),
|
||||
type_keyid = require('../type/keyid.js'),
|
||||
enums = require('../enums.js'),
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
module.exports = PublicKeyEncryptedSessionKey;
|
||||
|
||||
var type_keyid = require('../type/keyid.js'),
|
||||
util = require('../util'),
|
||||
util = require('../util.js'),
|
||||
type_mpi = require('../type/mpi.js'),
|
||||
enums = require('../enums.js'),
|
||||
crypto = require('../crypto');
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = SecretKey;
|
|||
|
||||
var publicKey = require('./public_key.js'),
|
||||
enums = require('../enums.js'),
|
||||
util = require('../util'),
|
||||
util = require('../util.js'),
|
||||
crypto = require('../crypto'),
|
||||
type_mpi = require('../type/mpi.js'),
|
||||
type_s2k = require('../type/s2k.js');
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
module.exports = Signature;
|
||||
|
||||
var util = require('../util'),
|
||||
var util = require('../util.js'),
|
||||
packet = require('./packet.js'),
|
||||
enums = require('../enums.js'),
|
||||
crypto = require('../crypto'),
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
module.exports = SymEncryptedIntegrityProtected;
|
||||
|
||||
var util = require('../util'),
|
||||
var util = require('../util.js'),
|
||||
crypto = require('../crypto');
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
* @module packet/user_attribute
|
||||
*/
|
||||
|
||||
var util = require('../util'),
|
||||
var util = require('../util.js'),
|
||||
packet = require('./packet.js');
|
||||
|
||||
module.exports = UserAttribute;
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
module.exports = Userid;
|
||||
|
||||
var util = require('../util');
|
||||
var util = require('../util.js');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
module.exports = Keyid;
|
||||
|
||||
var util = require('../util');
|
||||
var util = require('../util.js');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
module.exports = MPI;
|
||||
|
||||
var BigInteger = require('../crypto/public_key/jsbn.js'),
|
||||
util = require('../util');
|
||||
util = require('../util.js');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
module.exports = S2K;
|
||||
|
||||
var enums = require('../enums.js'),
|
||||
util = require('../util'),
|
||||
util = require('../util.js'),
|
||||
crypto = require('../crypto');
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
/**
|
||||
* This object contains utility functions
|
||||
* @requires config
|
||||
* @module util/util
|
||||
* @module util
|
||||
*/
|
||||
|
||||
var config = require('../config');
|
||||
var config = require('./config');
|
||||
|
||||
module.exports = {
|
||||
readNumber: function (bytes) {
|
||||
|
@ -194,7 +194,7 @@ module.exports = {
|
|||
/**
|
||||
* Convert a Uint8Array to a string. This currently functions
|
||||
* the same as bin2str.
|
||||
* @function module:util/util.Uint8Array2str
|
||||
* @function module:util.Uint8Array2str
|
||||
* @param {Uint8Array} bin An array of (binary) integers to convert
|
||||
* @return {String} String representation of the array
|
||||
*/
|
||||
|
|
|
@ -190,36 +190,36 @@ describe('API functional testing', function() {
|
|||
var RSApubMPIs = [];
|
||||
var i;
|
||||
for (i = 0; i < 2; i++) {
|
||||
RSApubMPIs[i] = new openpgp.mpi();
|
||||
RSApubMPIs[i] = new openpgp.MPI();
|
||||
RSApubMPIs[i].read(RSApubMPIstrs[i]);
|
||||
}
|
||||
|
||||
var RSAsecMPIs = [];
|
||||
for (i = 0; i < 4; i++) {
|
||||
RSAsecMPIs[i] = new openpgp.mpi();
|
||||
RSAsecMPIs[i] = new openpgp.MPI();
|
||||
RSAsecMPIs[i].read(RSAsecMPIstrs[i]);
|
||||
}
|
||||
|
||||
var DSAsecMPIs = [];
|
||||
for (i = 0; i < 1; i++) {
|
||||
DSAsecMPIs[i] = new openpgp.mpi();
|
||||
DSAsecMPIs[i] = new openpgp.MPI();
|
||||
DSAsecMPIs[i].read(DSAsecMPIstrs[i]);
|
||||
}
|
||||
|
||||
var DSApubMPIs = [];
|
||||
for (i = 0; i < 4; i++) {
|
||||
DSApubMPIs[i] = new openpgp.mpi();
|
||||
DSApubMPIs[i] = new openpgp.MPI();
|
||||
DSApubMPIs[i].read(DSApubMPIstrs[i]);
|
||||
}
|
||||
var ElgamalsecMPIs = [];
|
||||
for (i = 0; i < 1; i++) {
|
||||
ElgamalsecMPIs[i] = new openpgp.mpi();
|
||||
ElgamalsecMPIs[i] = new openpgp.MPI();
|
||||
ElgamalsecMPIs[i].read(ElgamalsecMPIstrs[i]);
|
||||
}
|
||||
|
||||
var ElgamalpubMPIs = [];
|
||||
for (i = 0; i < 3; i++) {
|
||||
ElgamalpubMPIs[i] = new openpgp.mpi();
|
||||
ElgamalpubMPIs[i] = new openpgp.MPI();
|
||||
ElgamalpubMPIs[i].read(ElgamalpubMPIstrs[i]);
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ describe('API functional testing', function() {
|
|||
//Originally we passed public and secret MPI separately, now they are joined. Is this what we want to do long term?
|
||||
// RSA
|
||||
var RSAsignedData = openpgp.crypto.signature.sign(2, 1, RSApubMPIs.concat(RSAsecMPIs), "foobar");
|
||||
var RSAsignedDataMPI = new openpgp.mpi();
|
||||
var RSAsignedDataMPI = new openpgp.MPI();
|
||||
RSAsignedDataMPI.read(RSAsignedData);
|
||||
var success = openpgp.crypto.signature.verify(1, 2, [RSAsignedDataMPI], RSApubMPIs, "foobar");
|
||||
expect(success).to.be.true;
|
||||
|
@ -240,8 +240,8 @@ describe('API functional testing', function() {
|
|||
var DSAsignedData = openpgp.crypto.signature.sign(2, 17, DSApubMPIs.concat(DSAsecMPIs), "foobar");
|
||||
|
||||
var DSAmsgMPIs = [];
|
||||
DSAmsgMPIs[0] = new openpgp.mpi();
|
||||
DSAmsgMPIs[1] = new openpgp.mpi();
|
||||
DSAmsgMPIs[0] = new openpgp.MPI();
|
||||
DSAmsgMPIs[1] = new openpgp.MPI();
|
||||
DSAmsgMPIs[0].read(DSAsignedData.substring(0,34));
|
||||
DSAmsgMPIs[1].read(DSAsignedData.substring(34,68));
|
||||
var success = openpgp.crypto.signature.verify(17, 2, DSAmsgMPIs, DSApubMPIs, "foobar");
|
||||
|
@ -271,7 +271,7 @@ describe('API functional testing', function() {
|
|||
});
|
||||
|
||||
it('Asymmetric using RSA with eme_pkcs1 padding', function (done) {
|
||||
var RSAUnencryptedData = new openpgp.mpi();
|
||||
var RSAUnencryptedData = new openpgp.MPI();
|
||||
RSAUnencryptedData.fromBytes(openpgp.crypto.pkcs1.eme.encode(symmKey, RSApubMPIs[0].byteLength()));
|
||||
var RSAEncryptedData = openpgp.crypto.publicKeyEncrypt("rsa_encrypt_sign", RSApubMPIs, RSAUnencryptedData);
|
||||
|
||||
|
@ -281,7 +281,7 @@ describe('API functional testing', function() {
|
|||
});
|
||||
|
||||
it('Asymmetric using Elgamal with eme_pkcs1 padding', function (done) {
|
||||
var ElgamalUnencryptedData = new openpgp.mpi();
|
||||
var ElgamalUnencryptedData = new openpgp.MPI();
|
||||
ElgamalUnencryptedData.fromBytes(openpgp.crypto.pkcs1.eme.encode(symmKey, ElgamalpubMPIs[0].byteLength()));
|
||||
var ElgamalEncryptedData = openpgp.crypto.publicKeyEncrypt("elgamal", ElgamalpubMPIs, ElgamalUnencryptedData);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var openpgp = require('openpgp'),
|
||||
keyring = new (require('keyring'))(),
|
||||
keyring = new openpgp.Keyring(),
|
||||
chai = require('chai'),
|
||||
expect = chai.expect;
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ describe("Packet", function() {
|
|||
var mpi = [mpi.n, mpi.ee, mpi.d, mpi.p, mpi.q, mpi.u];
|
||||
|
||||
mpi = mpi.map(function(k) {
|
||||
var mpi = new openpgp.mpi();
|
||||
var mpi = new openpgp.MPI();
|
||||
mpi.fromBigInteger(k);
|
||||
return mpi;
|
||||
});
|
||||
|
@ -386,7 +386,7 @@ describe("Packet", function() {
|
|||
var mpi = [mpi.n, mpi.ee, mpi.d, mpi.p, mpi.q, mpi.u];
|
||||
|
||||
mpi = mpi.map(function(k) {
|
||||
var mpi = new openpgp.mpi();
|
||||
var mpi = new openpgp.MPI();
|
||||
mpi.fromBigInteger(k);
|
||||
return mpi;
|
||||
});
|
||||
|
@ -414,7 +414,7 @@ describe("Packet", function() {
|
|||
var mpi = [mpi.n, mpi.ee, mpi.d, mpi.p, mpi.q, mpi.u];
|
||||
|
||||
mpi = mpi.map(function(k) {
|
||||
var mpi = new openpgp.mpi();
|
||||
var mpi = new openpgp.MPI();
|
||||
mpi.fromBigInteger(k);
|
||||
return mpi;
|
||||
});
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
<div id="mocha"></div>
|
||||
|
||||
<!--<script src="lib/jquery.min.js"></script>-->
|
||||
<script src="../resources/openpgp.js"></script>
|
||||
<script src="../resources/keyring.js"></script>
|
||||
<script src="../dist/openpgp.js"></script>
|
||||
<script src="lib/chai.js"></script>
|
||||
<script src="lib/mocha.js"></script>
|
||||
<script>
|
||||
|
|
Loading…
Reference in New Issue
Block a user