Skip to content

Commit

Permalink
Fix S-Box select error for new SignalCom key container
Browse files Browse the repository at this point in the history
  • Loading branch information
rudonick committed Oct 30, 2016
1 parent 80c19a7 commit a8caf28
Show file tree
Hide file tree
Showing 6 changed files with 223 additions and 215 deletions.
168 changes: 84 additions & 84 deletions dist/gostCrypto.dist.js

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions dist/gostEngine.dist.js

Large diffs are not rendered by default.

16 changes: 12 additions & 4 deletions gostASN1.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
// PEM coding
var PEM = gostCrypto.coding.PEM;

// Chars coding
var Chars = gostCrypto.coding.Chars;

// Hex coding;
var Hex = gostCrypto.coding.Hex;

Expand Down Expand Up @@ -197,8 +200,13 @@
if (typeof source === 'string')
source = PEM.decode(source, uniformTitle, false);
// Decode binary data
if (source instanceof CryptoOperationData)
source = BER.decode(source);
if (source instanceof CryptoOperationData) {
try {
source = PEM.decode(Chars.encode(source), uniformTitle, true);
} catch (e) {
source = BER.decode(source);
}
}

tagClass = tagClass || 0;
tagConstructed = tagConstructed || false;
Expand Down Expand Up @@ -632,7 +640,7 @@
source = decode(source, 0x10, 0, true, uniformTitle);
var i = 0, result = new this(), data = result.items = {};
for (var name in structure) {
console.log(name, 'decoding...');
// console.log(name, 'decoding...');
// try to create and decode object
var ItemClass = result.getItemClass(name, data);
var item = ItemClass.decode(source[i]);
Expand Down Expand Up @@ -948,7 +956,7 @@
// repare source
var object = this.items, source = [];
for (var id in object) {
console.log(id, object[id], 'encoding...');
// console.log(id, object[id], 'encoding...');
var encoded = object[id].encode(true);
if (encoded !== undefined)
source.push(encoded);
Expand Down
2 changes: 1 addition & 1 deletion gostCipher.js
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,7 @@
// Define sBox parameter
var sBox = algorithm.sBox, sBoxName;
if (!sBox)
sBox = this.version === 2015 ? sBoxes['E-Z'] : sBoxes['E-A'];
sBox = this.version === 2015 ? sBoxes['E-Z'] : this.procreator === 'SC' ? sBoxes['E-SC'] : sBoxes['E-A'];
else if (typeof sBox === 'string') {
sBoxName = sBox.toUpperCase();
sBox = sBoxes[sBoxName];
Expand Down
Loading

0 comments on commit a8caf28

Please sign in to comment.