Browse Source

fix encrypt/decrypt for tribe messages longer than 256 chars

hosting-provider
Evan Feenstra 5 years ago
parent
commit
099432abd6
  1. 46
      api/crypto/rsa.ts
  2. 3
      app.ts
  3. 1
      dist/api/controllers/chatTribes.js
  4. 2
      dist/api/controllers/chatTribes.js.map
  5. 44
      dist/api/crypto/rsa.js
  6. 2
      dist/api/crypto/rsa.js.map
  7. 9
      dist/api/utils/tribes.js
  8. 2
      dist/api/utils/tribes.js.map
  9. 3
      dist/app.js
  10. 2
      dist/app.js.map

46
api/crypto/rsa.ts

@ -1,13 +1,23 @@
import * as crypto from "crypto";
const BLOCK_SIZE=256
const MAX_CHUNK_SIZE=BLOCK_SIZE-11 // 11 is the PCKS1 padding
export function encrypt(key, txt){
try{
const buf = Buffer.from(txt)
let finalBuf = Buffer.from([])
const n = Math.ceil(buf.length/MAX_CHUNK_SIZE)
const arr = Array(n).fill(0)
const pubc = cert.pub(key)
const buf = crypto.publicEncrypt({
key:pubc,
padding:crypto.constants.RSA_PKCS1_PADDING,
}, Buffer.from(txt,'utf-8'))
return buf.toString('base64')
arr.forEach((_,i)=>{
const f = crypto.publicEncrypt({
key:pubc,
padding:crypto.constants.RSA_PKCS1_PADDING,
}, buf.subarray(i*MAX_CHUNK_SIZE,i*MAX_CHUNK_SIZE+MAX_CHUNK_SIZE))
finalBuf = Buffer.concat([finalBuf,f])
})
return finalBuf.toString('base64')
} catch(e) {
return ''
}
@ -15,12 +25,19 @@ export function encrypt(key, txt){
export function decrypt(privateKey, enc){
try{
const buf = Buffer.from(enc, 'base64')
let finalDec = ''
const n = Math.ceil(buf.length/BLOCK_SIZE)
const arr = Array(n).fill(0)
const privc = cert.priv(privateKey)
const buf = crypto.privateDecrypt({
key:privc,
padding:crypto.constants.RSA_PKCS1_PADDING,
}, Buffer.from(enc,'base64'))
return buf.toString('utf-8')
arr.forEach((_,i)=>{
const b = crypto.privateDecrypt({
key:privc,
padding:crypto.constants.RSA_PKCS1_PADDING,
}, buf.subarray(i*BLOCK_SIZE,i*BLOCK_SIZE+BLOCK_SIZE))
finalDec += b.toString('utf-8')
})
return finalDec
} catch(e) {
return ''
}
@ -50,7 +67,7 @@ export function genKeys(): Promise<{[k:string]:string}>{
export function testRSA(){
crypto.generateKeyPair('rsa', {
modulusLength: 2048
}, (err, publicKey, priv)=>{
}, (err, publicKey, privateKey)=>{
const pubPEM = publicKey.export({
type:'pkcs1',format:'pem'
})
@ -59,8 +76,13 @@ export function testRSA(){
const msg = 'hi'
const enc = encrypt(pub, msg)
const privPEM = privateKey.export({
type:'pkcs1',format:'pem'
})
const priv = cert.unpriv(privPEM)
const dec = decrypt(priv, enc)
console.log("FINAL:",dec)
console.log("SUCESS:",msg===dec)
})
}

3
app.ts

@ -11,6 +11,7 @@ import {setupDatabase, setupDone} from './api/utils/setup'
import * as controllers from './api/controllers'
import * as socket from './api/utils/socket'
import * as network from './api/network'
import * as rsa from './api/crypto/rsa'
let server: any = null
const port = process.env.PORT || 3001;
@ -25,6 +26,8 @@ var i = 0
connectToLND()
async function connectToLND(){
rsa.testRSA()
return
i++
console.log(`=> [lnd] connecting... attempt #${i}`)
try {

1
dist/api/controllers/chatTribes.js

@ -112,7 +112,6 @@ function editTribe(req, res) {
let okToUpdate = true;
if (is_listed) {
try {
console.log("LLLLL", escrow_amount, escrow_millis);
yield tribes.edit({
uuid: chat.uuid,
name: name,

2
dist/api/controllers/chatTribes.js.map

File diff suppressed because one or more lines are too long

44
dist/api/crypto/rsa.js

@ -1,14 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const crypto = require("crypto");
const BLOCK_SIZE = 256;
const MAX_CHUNK_SIZE = BLOCK_SIZE - 11; // 11 is the PCKS1 padding
function encrypt(key, txt) {
try {
const buf = Buffer.from(txt);
let finalBuf = Buffer.from([]);
const n = Math.ceil(buf.length / MAX_CHUNK_SIZE);
const arr = Array(n).fill(0);
const pubc = cert.pub(key);
const buf = crypto.publicEncrypt({
key: pubc,
padding: crypto.constants.RSA_PKCS1_PADDING,
}, Buffer.from(txt, 'utf-8'));
return buf.toString('base64');
arr.forEach((_, i) => {
const f = crypto.publicEncrypt({
key: pubc,
padding: crypto.constants.RSA_PKCS1_PADDING,
}, buf.subarray(i * MAX_CHUNK_SIZE, i * MAX_CHUNK_SIZE + MAX_CHUNK_SIZE));
finalBuf = Buffer.concat([finalBuf, f]);
});
return finalBuf.toString('base64');
}
catch (e) {
return '';
@ -17,12 +26,19 @@ function encrypt(key, txt) {
exports.encrypt = encrypt;
function decrypt(privateKey, enc) {
try {
const buf = Buffer.from(enc, 'base64');
let finalDec = '';
const n = Math.ceil(buf.length / BLOCK_SIZE);
const arr = Array(n).fill(0);
const privc = cert.priv(privateKey);
const buf = crypto.privateDecrypt({
key: privc,
padding: crypto.constants.RSA_PKCS1_PADDING,
}, Buffer.from(enc, 'base64'));
return buf.toString('utf-8');
arr.forEach((_, i) => {
const b = crypto.privateDecrypt({
key: privc,
padding: crypto.constants.RSA_PKCS1_PADDING,
}, buf.subarray(i * BLOCK_SIZE, i * BLOCK_SIZE + BLOCK_SIZE));
finalDec += b.toString('utf-8');
});
return finalDec;
}
catch (e) {
return '';
@ -53,15 +69,19 @@ exports.genKeys = genKeys;
function testRSA() {
crypto.generateKeyPair('rsa', {
modulusLength: 2048
}, (err, publicKey, priv) => {
}, (err, publicKey, privateKey) => {
const pubPEM = publicKey.export({
type: 'pkcs1', format: 'pem'
});
const pub = cert.unpub(pubPEM);
const msg = 'hi';
const enc = encrypt(pub, msg);
const privPEM = privateKey.export({
type: 'pkcs1', format: 'pem'
});
const priv = cert.unpriv(privPEM);
const dec = decrypt(priv, enc);
console.log("FINAL:", dec);
console.log("SUCESS:", msg === dec);
});
}
exports.testRSA = testRSA;

2
dist/api/crypto/rsa.js.map

@ -1 +1 @@
{"version":3,"file":"rsa.js","sourceRoot":"","sources":["../../../api/crypto/rsa.ts"],"names":[],"mappings":";;AAAA,iCAAiC;AAEjC,SAAgB,OAAO,CAAC,GAAG,EAAE,GAAG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AAI,EAAC,UAAS,GAAG;QACf,OAAO,mCAAmC;YACxC,GAAG,GAAG,IAAI;YACV,+BAA+B,CAAA;IACnC,CAAC;CACF,CAAA"}

9
dist/api/utils/tribes.js

@ -126,15 +126,6 @@ function edit({ uuid, host, name, description, tags, img, price_per_message, pri
}),
headers: { 'Content-Type': 'application/json' }
});
console.log(JSON.stringify({
uuid,
name, description, tags, img: img || '',
price_per_message: price_per_message || 0,
price_to_join: price_to_join || 0,
escrow_amount: escrow_amount || 0,
escrow_millis: escrow_millis || 0,
owner_alias,
}));
// const j = await r.json()
}
catch (e) {

2
dist/api/utils/tribes.js.map

File diff suppressed because one or more lines are too long

3
dist/app.js

@ -22,6 +22,7 @@ const setup_1 = require("./api/utils/setup");
const controllers = require("./api/controllers");
const socket = require("./api/utils/socket");
const network = require("./api/network");
const rsa = require("./api/crypto/rsa");
let server = null;
const port = process.env.PORT || 3001;
const env = process.env.NODE_ENV || 'development';
@ -32,6 +33,8 @@ var i = 0;
connectToLND();
function connectToLND() {
return __awaiter(this, void 0, void 0, function* () {
rsa.testRSA();
return;
i++;
console.log(`=> [lnd] connecting... attempt #${i}`);
try {

2
dist/app.js.map

@ -1 +1 @@
{"version":3,"file":"app.js","sourceRoot":"","sources":["../app.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAkC;AAClC,0CAAyC;AACzC,iCAAgC;AAChC,8CAA6C;AAC7C,iCAAgC;AAChC,6BAA4B;AAC5B,yCAAmC;AACnC,+CAAuC;AACvC,mCAAkE;AAClE,6CAA0D;AAC1D,iDAAgD;AAChD,6CAA4C;AAC5C,yCAAwC;AAExC,IAAI,MAAM,GAAQ,IAAI,CAAA;AACtB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AACtC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;AAClD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IA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