Skip to content

Commit

Permalink
Merge pull request #159 from honzikpoul/pkcs1-fix
Browse files Browse the repository at this point in the history
pkcs1 fix
  • Loading branch information
rzcoder committed Sep 19, 2019
2 parents 9feef4b + 9314c6e commit ae3fe05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.idea
.tmp
node_modules/
.nyc_output
.nyc_output
nbproject/
4 changes: 2 additions & 2 deletions src/schemes/pkcs1.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ module.exports.makeScheme = function (key, options) {

/* Type 1: zeros padding for private key decrypt */
if (options.type === 1) {
if (buffer[0] !== 0 && buffer[1] !== 1) {
if (buffer[0] !== 0 || buffer[1] !== 1) {
return null;
}
i = 3;
Expand All @@ -124,7 +124,7 @@ module.exports.makeScheme = function (key, options) {
}
} else {
/* random padding for public key decrypt */
if (buffer[0] !== 0 && buffer[1] !== 2) {
if (buffer[0] !== 0 || buffer[1] !== 2) {
return null;
}
i = 3;
Expand Down

0 comments on commit ae3fe05

Please sign in to comment.