@@ -3123,8 +3123,7 @@ static ManagedEVPPKey GetPrivateKeyFromJs(
3123
3123
3124
3124
static ManagedEVPPKey GetPublicOrPrivateKeyFromJs (
3125
3125
const FunctionCallbackInfo<Value>& args,
3126
- unsigned int * offset,
3127
- bool allow_key_object) {
3126
+ unsigned int * offset) {
3128
3127
if (args[*offset]->IsString () || Buffer::HasInstance (args[*offset])) {
3129
3128
Environment* env = Environment::GetCurrent (args);
3130
3129
ByteSource data = ByteSource::FromStringOrBuffer (env, args[(*offset)++]);
@@ -3172,7 +3171,7 @@ static ManagedEVPPKey GetPublicOrPrivateKeyFromJs(
3172
3171
ThrowCryptoError (env, ERR_get_error (), " Failed to read asymmetric key" );
3173
3172
return ManagedEVPPKey (pkey.release ());
3174
3173
} else {
3175
- CHECK (args[*offset]->IsObject () && allow_key_object );
3174
+ CHECK (args[*offset]->IsObject ());
3176
3175
KeyObject* key = Unwrap<KeyObject>(args[*offset].As <Object>());
3177
3176
CHECK (key);
3178
3177
CHECK_NE (key->GetKeyType (), kKeyTypeSecret );
@@ -3382,7 +3381,7 @@ void KeyObject::Init(const FunctionCallbackInfo<Value>& args) {
3382
3381
CHECK_EQ (args.Length (), 3 );
3383
3382
3384
3383
offset = 0 ;
3385
- pkey = GetPublicOrPrivateKeyFromJs (args, &offset, false );
3384
+ pkey = GetPublicOrPrivateKeyFromJs (args, &offset);
3386
3385
if (!pkey)
3387
3386
return ;
3388
3387
key->InitPublic (pkey);
@@ -4649,7 +4648,7 @@ void Verify::VerifyFinal(const FunctionCallbackInfo<Value>& args) {
4649
4648
ASSIGN_OR_RETURN_UNWRAP (&verify, args.Holder ());
4650
4649
4651
4650
unsigned int offset = 0 ;
4652
- ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs (args, &offset, true );
4651
+ ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs (args, &offset);
4653
4652
if (!pkey)
4654
4653
return ;
4655
4654
@@ -4712,7 +4711,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
4712
4711
Environment* env = Environment::GetCurrent (args);
4713
4712
4714
4713
unsigned int offset = 0 ;
4715
- ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs (args, &offset, true );
4714
+ ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs (args, &offset);
4716
4715
if (!pkey)
4717
4716
return ;
4718
4717
0 commit comments