@@ -3123,8 +3123,7 @@ static ManagedEVPPKey GetPrivateKeyFromJs(
31233123
31243124static ManagedEVPPKey GetPublicOrPrivateKeyFromJs (
31253125 const FunctionCallbackInfo<Value>& args,
3126- unsigned int * offset,
3127- bool allow_key_object) {
3126+ unsigned int * offset) {
31283127 if (args[*offset]->IsString () || Buffer::HasInstance (args[*offset])) {
31293128 Environment* env = Environment::GetCurrent (args);
31303129 ByteSource data = ByteSource::FromStringOrBuffer (env, args[(*offset)++]);
@@ -3172,7 +3171,7 @@ static ManagedEVPPKey GetPublicOrPrivateKeyFromJs(
31723171 ThrowCryptoError (env, ERR_get_error (), " Failed to read asymmetric key" );
31733172 return ManagedEVPPKey (pkey.release ());
31743173 } else {
3175- CHECK (args[*offset]->IsObject () && allow_key_object );
3174+ CHECK (args[*offset]->IsObject ());
31763175 KeyObject* key = Unwrap<KeyObject>(args[*offset].As <Object>());
31773176 CHECK (key);
31783177 CHECK_NE (key->GetKeyType (), kKeyTypeSecret );
@@ -3382,7 +3381,7 @@ void KeyObject::Init(const FunctionCallbackInfo<Value>& args) {
33823381 CHECK_EQ (args.Length (), 3 );
33833382
33843383 offset = 0 ;
3385- pkey = GetPublicOrPrivateKeyFromJs (args, &offset, false );
3384+ pkey = GetPublicOrPrivateKeyFromJs (args, &offset);
33863385 if (!pkey)
33873386 return ;
33883387 key->InitPublic (pkey);
@@ -4649,7 +4648,7 @@ void Verify::VerifyFinal(const FunctionCallbackInfo<Value>& args) {
46494648 ASSIGN_OR_RETURN_UNWRAP (&verify, args.Holder ());
46504649
46514650 unsigned int offset = 0 ;
4652- ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs (args, &offset, true );
4651+ ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs (args, &offset);
46534652 if (!pkey)
46544653 return ;
46554654
@@ -4712,7 +4711,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
47124711 Environment* env = Environment::GetCurrent (args);
47134712
47144713 unsigned int offset = 0 ;
4715- ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs (args, &offset, true );
4714+ ManagedEVPPKey pkey = GetPublicOrPrivateKeyFromJs (args, &offset);
47164715 if (!pkey)
47174716 return ;
47184717
0 commit comments