GLib.Hmac unusable?



Hello there,
  I wonder if I'm doing it wrong or if there's actually a bug in either GJS or the GLib I'm using.

While it's straight forward to `new GLib.Checksum(GLib.Checksum.SHA1);` and then use `.update(data)` and `.get_string()`, it's basically impossible to do the same with `GLib.Hmac`.

This is not exposed as constructor, so any attempt to `new GLib.Hmac` would fail, and on top of that, any attempt to use `GLib.compute_hmac_for_data` fails.

Example:
```js
GLib.compute_hmac_for_data(
  GLib.Checksum.SHA1,
  'secret',
  'secret'.length,
  'generic data content',
  GLib.checksum_type_get_length(GLib.Checksum.SHA1)
);
```

I'm not sure there's something wrong in my invoke but I keep having this kind of error, no matter how I shuffle those parameters (well, actually in some case I also have Segmentation fault (core dumped))

```
(gjs:7105): GLib-CRITICAL **: g_compute_hmac_for_data: assertion 'length == 0 || data != NULL' failed
null
```

Thanks in advance for any sort of outcome.

Best Regards


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]