Skip to content

Commit

Permalink
refactor parsePBES2
Browse files Browse the repository at this point in the history
  • Loading branch information
emmansun authored Apr 7, 2024
1 parent d6ba93c commit 1f45bf1
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/sm2.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,12 +719,7 @@ rs.KEYUTIL.parsePBES2 = function (hP8Prv) {
}
const salt = util.aryval(pASNKDF, '0.octstr.hex')
const hIter = util.aryval(pASNKDF, '1.int.hex')
let prf
if (pASNKDF.length === 4) {
prf = util.aryval(pASNKDF, '3.seq.0.oid', 'hmacWithSHA1')
} else {
prf = util.aryval(pASNKDF, '2.seq.0.oid', 'hmacWithSHA1')
}
const prf = util.aryval(pASNKDF, `${pASNKDF.length - 1}.seq.0.oid`, 'hmacWithSHA1')
let iter = -1
try {
iter = parseInt(hIter, 16)
Expand Down

0 comments on commit 1f45bf1

Please sign in to comment.