A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/openpgpjs/openpgpjs/commit/e8ef355604bd1ff5797f64b20b50a62bb33abe45 below:

OP-01-010 Invalid Armor Checksum Validation (Low) · openpgpjs/openpgpjs@e8ef355 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+30

-2

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+30

-2

lines changed Original file line number Diff line number Diff line change

@@ -131,7 +131,7 @@ function getCheckSum(data) {

131 131

function verifyCheckSum(data, checksum) {

132 132

var c = getCheckSum(data);

133 133

var d = checksum;

134 -

return c[0] == d[0] && c[1] == d[1] && c[2] == d[2];

134 +

return c[0] == d[0] && c[1] == d[1] && c[2] == d[2] && c[3] == d[3];

135 135

}

136 136

/**

137 137

* Internal function to calculate a CRC-24 checksum over a given string (data)

@@ -323,11 +323,13 @@ function dearmor(text) {

323 323

checksum = sig_sum.checksum;

324 324

}

325 325 326 +

checksum = checksum.substr(0, 4);

327 + 326 328

if (!verifyCheckSum(result.data, checksum)) {

327 329

throw new Error("Ascii armor integrity check on message failed: '" +

328 330

checksum +

329 331

"' should be '" +

330 -

getCheckSum(result) + "'");

332 +

getCheckSum(result.data) + "'");

331 333

}

332 334 333 335

verifyHeaders(result.headers);

Original file line number Diff line number Diff line change

@@ -131,6 +131,32 @@ describe("ASCII armor", function() {

131 131

expect(msg).to.throw(Error, /Unknow ASCII armor type/);

132 132

});

133 133 134 +

it('Armor checksum validation', function () {

135 +

var privKey =

136 +

['-----BEGIN PGP PRIVATE KEY BLOCK-----',

137 +

'Version: OpenPGP.js v0.3.0',

138 +

'Comment: http://openpgpjs.org',

139 +

'',

140 +

'xbYEUubX7gEBANDWhzoP+Tr/IyRSv++vl5jBesQIPTYGQBdzF4YDnGEBABEB',

141 +

'AAH+CQMIfzdw4/PKNl5gVXdtfDFdSIN8yJT2rbeg3+SsWexXZNNdRaONWaiB',

142 +

'Z5cG9Q6+BoXKsEshIdcYOgwsAgRxlPpRA34Vvmg2QBk7PhdrkbK7aqENsJ1w',

143 +

'dIlLD6p9GmLE20yVff58/fMiUtPRgsD83SpKTAX6EM1ulpkuQQNjmrVc5qc8',

144 +

'7AMdF80JdW5kZWZpbmVkwj8EEAEIABMFAlLm1+4JEBD8MASZrpALAhsDAAAs',

145 +

'QgD8CUrwv7Hrp/INR0/UvAvzS52VztREQwQWTJMrgTNHBGjHtgRS5tfuAQEA',

146 +

'nys9SaSgR+l6iZc/M8hGIUmbuahE2/+mtw+/l0RO+WcAEQEAAf4JAwjr39Yi',

147 +

'FzjxImDN1IoYVsonA9M+BtIIJHafuQUHjyEr1paJJK5xS6KlyGgpMTXTD6y/',

148 +

'qxS3ZSPPzHGRrs2CmkVEiPmurn9Ed05tb0y9OnJkWtuh3z9VVq9d8zHzuENa',

149 +

'bUfli+P/v+dRaZ+1rSOxUFbFYbFB5XK/A9b/OPFrv+mb4KrtLxugwj8EGAEI',

150 +

'ABMFAlLm1+4JEBD8MASZrpALAhsMAAC3IgD8DnLGbMnpLtrX72RCkPW1ffLq',

151 +

'71vlXMJNXvoCeuejiRw=',

152 +

'=wJN@',

153 +

'-----END PGP PRIVATE KEY BLOCK-----'].join('\n');

154 + 155 +

var result = openpgp.key.readArmored(privKey);

156 +

expect(result.err).to.exist;

157 +

expect(result.err[0].message).to.match(/Ascii armor integrity check on message failed/);

158 +

});

159 + 134 160

});

135 161 136 162

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4