Skip to content

Commit ae3fe05

Browse files
authored
Merge pull request #159 from honzikpoul/pkcs1-fix
pkcs1 fix
2 parents 9feef4b + 9314c6e commit ae3fe05

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
.idea
33
.tmp
44
node_modules/
5-
.nyc_output
5+
.nyc_output
6+
nbproject/

src/schemes/pkcs1.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ module.exports.makeScheme = function (key, options) {
113113

114114
/* Type 1: zeros padding for private key decrypt */
115115
if (options.type === 1) {
116-
if (buffer[0] !== 0 && buffer[1] !== 1) {
116+
if (buffer[0] !== 0 || buffer[1] !== 1) {
117117
return null;
118118
}
119119
i = 3;
@@ -124,7 +124,7 @@ module.exports.makeScheme = function (key, options) {
124124
}
125125
} else {
126126
/* random padding for public key decrypt */
127-
if (buffer[0] !== 0 && buffer[1] !== 2) {
127+
if (buffer[0] !== 0 || buffer[1] !== 2) {
128128
return null;
129129
}
130130
i = 3;

0 commit comments

Comments
 (0)