Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@platynum/rocatest

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platynum/rocatest - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

bin/keytest.js

18

package.json
{
"name": "@platynum/rocatest",
"version": "1.0.4",
"version": "1.1.0",
"description": "Test jsrsasign keys for the ROCA vulnerability",
"main": "rocatest.js",
"main": "./bin/keytest.js",
"scripts": {

@@ -18,2 +18,3 @@ "test": "mocha --slow 1000 --timeout 200000 test"

"keywords": [
"cab",
"rsa",

@@ -29,7 +30,11 @@ "roca"

"bin": {
"rocatest": "./bin/rocatest.js"
"keytest": "./bin/keytest.js"
},
"dependencies": {
"big-integer": "^1.6.48"
"big-integer": "^1.6.51",
"bigint-isqrt": "^0.2.1"
},
"optionalDependencies": {
"yargs": "^17.3.1"
},
"peerDependencies": {

@@ -40,5 +45,6 @@ "jsrsasign": "8.x || 9.x || 10.x"

"chai": "^4.3.4",
"eslint": "^7.22.0",
"mocha": "^8.3.2"
"eslint": "^8.16.0",
"mocha": "^10.0.0",
"pkg": "^5.5.2"
}
}

@@ -26,9 +26,9 @@ # Javascript ROCA test

```javascript
var jsrsasign = require('jsrsasign');
var roca = require('../rocatest');
const jsrsasign = require('jsrsasign');
const { rocatest } = require('@platynum/rocatest');
var key = jsrsasign.KEYUTIL.generateKeypair('RSA', 512);
if (roca.check(key.pubKeyObj) === true)
let key = jsrsasign.KEYUTIL.generateKeypair('RSA', 512);
if (rocatest.check(key.pubKeyObj) === true)
console.log('Key is vulnerable');
```

@@ -1,41 +0,41 @@

var jsrsasign = require('jsrsasign');
var fs = require('fs');
var expect = require('chai').expect;
const jsrsasign = require('jsrsasign');
const fs = require('node:fs');
const expect = require('chai').expect;
var roca = require('../rocatest');
const roca = require('../scripts/rocatest');
describe('roca', function() {
describe('ROCA', function() {
describe('check', function() {
it('should recognize ROCA-1 key', function() {
var pem = fs.readFileSync('test/roca-1.key.pem', 'utf-8');
var key = jsrsasign.KEYUTIL.getKey(pem);
let pem = fs.readFileSync('test/roca/1.key.pem', 'utf8');
let key = jsrsasign.KEYUTIL.getKey(pem);
expect(roca.check(key)).to.be.true;
});
it('should recognize ROCA-2 key', function() {
var pem = fs.readFileSync('test/roca-2.key.pem', 'utf-8');
var key = jsrsasign.KEYUTIL.getKey(pem);
let pem = fs.readFileSync('test/roca/2.key.pem', 'utf8');
let key = jsrsasign.KEYUTIL.getKey(pem);
expect(roca.check(key)).to.be.true;
});
it('should pass EC key', function() {
var key = jsrsasign.KEYUTIL.generateKeypair('EC', 'secp256r1');
let key = jsrsasign.KEYUTIL.generateKeypair('EC', 'secp256r1');
expect(roca.check(key.prvKeyObj)).to.be.false;
});
it('should pass generated public key (512 bit)', function() {
var key = jsrsasign.KEYUTIL.generateKeypair('RSA', 512);
let key = jsrsasign.KEYUTIL.generateKeypair('RSA', 512);
expect(roca.check(key.prvKeyObj)).to.be.false;
});
it('should pass generated private key (1024 bit)', function() {
var key = jsrsasign.KEYUTIL.generateKeypair('RSA', 1024);
let key = jsrsasign.KEYUTIL.generateKeypair('RSA', 1024);
expect(roca.check(key.pubKeyObj)).to.be.false;
});
it('should pass generated private key (2048 bit)', function() {
var key = jsrsasign.KEYUTIL.generateKeypair('RSA', 2048);
let key = jsrsasign.KEYUTIL.generateKeypair('RSA', 2048);
expect(roca.check(key.pubKeyObj)).to.be.false;
});
it('should pass generated public key (3072 bit)', function() {
var key = jsrsasign.KEYUTIL.generateKeypair('RSA', 3072);
let key = jsrsasign.KEYUTIL.generateKeypair('RSA', 3072);
expect(roca.check(key.prvKeyObj)).to.be.false;
});
it('should pass generated public key (4096 bit)', function() {
var key = jsrsasign.KEYUTIL.generateKeypair('RSA', 4096);
let key = jsrsasign.KEYUTIL.generateKeypair('RSA', 4096);
expect(roca.check(key.prvKeyObj)).to.be.false;

@@ -42,0 +42,0 @@ });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc