File tree 1 file changed +15
-9
lines changed
1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change 15
15
16
16
namespace node {
17
17
18
+ using v8::ArrayBuffer;
19
+ using v8::BackingStore;
18
20
using v8::FunctionCallbackInfo;
19
21
using v8::Int32;
20
22
using v8::Just;
@@ -555,17 +557,21 @@ Maybe<bool> GetRsaKeyDetail(
555
557
return Nothing<bool >();
556
558
}
557
559
558
- int len = BN_num_bytes (e);
559
- AllocatedBuffer public_exponent = AllocatedBuffer::AllocateManaged (env, len);
560
- unsigned char * data =
561
- reinterpret_cast <unsigned char *>(public_exponent.data ());
562
- CHECK_EQ (BN_bn2binpad (e, data, len), len);
560
+ std::unique_ptr<BackingStore> public_exponent;
561
+ {
562
+ NoArrayBufferZeroFillScope no_zero_fill_scope (env->isolate_data ());
563
+ public_exponent =
564
+ ArrayBuffer::NewBackingStore (env->isolate (), BN_num_bytes (e));
565
+ }
566
+ CHECK_EQ (BN_bn2binpad (e,
567
+ static_cast <unsigned char *>(public_exponent->Data ()),
568
+ public_exponent->ByteLength ()),
569
+ static_cast <int >(public_exponent->ByteLength ()));
563
570
564
571
if (target
565
- ->Set (
566
- env->context (),
567
- env->public_exponent_string (),
568
- public_exponent.ToArrayBuffer ())
572
+ ->Set (env->context (),
573
+ env->public_exponent_string (),
574
+ ArrayBuffer::New (env->isolate (), std::move (public_exponent)))
569
575
.IsNothing ()) {
570
576
return Nothing<bool >();
571
577
}
You can’t perform that action at this time.
0 commit comments