Close, except it should be `int i =
certificate->VerifySpkac(const_cast<const char*>(data), length);`. Also I'd
do:
```cpp
if (length == 0)
  return Undefined(node_isolate);
assert(data != NULL);
```
`NULL` should never be returned if `length > 0`. If it is then there're are
much bigger problems.


On Wed, Jul 3, 2013 at 5:25 AM, Jas- <notifications@github.com> wrote:

> In src/node_crypto.cc:
>
> > +    return ThrowTypeError("Missing argument");
> > +
> > +  ASSERT_IS_BUFFER(args[0]);
> > +  size_t length = Buffer::Length(args[0]);
> > +
> > +  const char* data = Buffer::Data(args[0]);
> > +  if (data == NULL)
> > +    return Undefined(node_isolate);
> > +
> > +  int i = certificate->VerifySpkac(data, length);
> > +
> > +  return Boolean::New(i > 0);
> > +}
> > +
> > +
> > +const char* Certificate::ExportPublicKey(const char* data, int len) {
>
> Thanks for the info @trevnorris <https://github.com/trevnorris>!
>
> Regarding Buffer::Data() returning a char*, it should look like this then?
>
> ```char* data = Buffer::Data(args[0]);
>
> if (data == NULL)
> return Undefined(node_isolate);
>
> int i = certificate->VerifySpkac(const_cast(data), length);
>
> return Boolean::New(i > 0);```
>
> I do appreciate all the help you and @bnoordhuis<https://github.com/bnoordhuis>have been giving me
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/joyent/node/pull/5604/files#r5007544>
> .
>