Skip to content

Commit

Permalink
Fix conditions in setPrivate and in setPrivateEx
Browse files Browse the repository at this point in the history
  • Loading branch information
veikkos committed Sep 13, 2022
1 parent 8b62461 commit 4066435
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rsa.ts
Expand Up @@ -109,7 +109,7 @@ export class RSAKey {

// Set the private key fields N, e, and d from hex strings
setPrivate(N: string, E: string, D: string): void {
if (!N && !E && N.length > 0 && E.length > 0) {
if (N && E && N.length > 0 && E.length > 0) {
this.n = parseBigInt(N, 16)
this.e = parseInt(E, 16)
this.d = parseBigInt(D, 16)
Expand All @@ -127,7 +127,7 @@ export class RSAKey {
DQ: string,
C: string,
): void {
if (!N && !E && N.length > 0 && E.length > 0) {
if (N && E && N.length > 0 && E.length > 0) {
this.n = parseBigInt(N, 16)
this.e = parseInt(E, 16)
this.d = parseBigInt(D, 16)
Expand Down

0 comments on commit 4066435

Please sign in to comment.