| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 39246f6 commit 7c51275
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,10 +42,8 @@ | |||
| 42 | 42 | return ThrowException(Exception::TypeError(String::New("Not a string or buffer"))); \ | |
| 43 | 43 | } | |
| 44 | 44 | ||
| 45 | - static const char *RSA_PUB_KEY_PFX = "-----BEGIN RSA PUBLIC KEY-----"; | ||
| 46 | - static const char *DSA_PUB_KEY_PFX = "-----BEGIN PUBLIC KEY-----"; | ||
| 47 | - static const int RSA_PUB_KEY_PFX_LEN = strlen(RSA_PUB_KEY_PFX); | ||
| 48 | - static const int DSA_PUB_KEY_PFX_LEN = strlen(DSA_PUB_KEY_PFX); | ||
| 45 | + static const char *PUBLIC_KEY_PFX = "-----BEGIN PUBLIC KEY-----"; | ||
| 46 | + static const int PUBLIC_KEY_PFX_LEN = strlen(PUBLIC_KEY_PFX); | ||
| 49 | 47 | ||
| 50 | 48 | namespace node { | |
| 51 | 49 | namespace crypto { | |
@@ -2776,10 +2774,8 @@ class Verify : public ObjectWrap { | |||
| 2776 | 2774 | return 0; | |
| 2777 | 2775 | } | |
| 2778 | 2776 | ||
| 2779 | - // Check if this is an RSA or DSA "raw" public key before trying | ||
| 2780 | - // X.509 | ||
| 2781 | - if (strncmp(key_pem, RSA_PUB_KEY_PFX, RSA_PUB_KEY_PFX_LEN) == 0 || | ||
| 2782 | - strncmp(key_pem, DSA_PUB_KEY_PFX, DSA_PUB_KEY_PFX_LEN) == 0) { | ||
| 2777 | + // Check if this is a PKCS#8 public key before trying as X.509 | ||
| 2778 | + if (strncmp(key_pem, PUBLIC_KEY_PFX, PUBLIC_KEY_PFX_LEN) == 0) { | ||
| 2783 | 2779 | pkey = PEM_read_bio_PUBKEY(bp, NULL, NULL, NULL); | |
| 2784 | 2780 | if (pkey == NULL) { | |
| 2785 | 2781 | ERR_print_errors_fp(stderr); | |
@@ -2801,8 +2797,6 @@ class Verify : public ObjectWrap { | |||
| 2801 | 2797 | } | |
| 2802 | 2798 | ||
| 2803 | 2799 | r = EVP_VerifyFinal(&mdctx, sig, siglen, pkey); | |
| 2804 | - if (r != 1) | ||
| 2805 | - ERR_print_errors_fp (stderr); | ||
| 2806 | 2800 | ||
| 2807 | 2801 | if(pkey != NULL) | |
| 2808 | 2802 | EVP_PKEY_free (pkey); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments