Code Monkey home page Code Monkey logo

key-parsers's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

key-parsers's Issues

Key-parsers 0.6.0 breaks pkcs11

Hi,

I updated key-parsers to 0.6.0 and it seems that it creates an unusable installation:

ocamlfind ocamlc -c -g -package records -package ppx_deriving_yojson -package ppx_deriving.std -package key-parsers -package hex -package ctypes.stubs -package ctypes.foreign -I src -I include -o src/pkcs11_CK_ATTRIBUTE_TYPE.cmi src/pkcs11_CK_ATTRIBUTE_TYPE.mli
File "src/pkcs11_CK_ATTRIBUTE_TYPE.mli", line 67, characters 20-48:
Error: The module Key_parsers.Asn1 is an alias for module Kp_asn1, which is missing
Command exited with code 2.

Removing the ~api parameter in pkg.ml will work, but exposes Kp_asn1 too. If you wish you can release that as 0.6.1.
Note that you can include that as part of your CI by passing REVDEPS=pkcs11 in your env matrix (doc).

✨ Thanks ✨

EC parameters are serialized as invalid JSON

EC parameters (and other parts) serialize Cstruct values directly as plain strings. This does not work for binary data, because JSON strings represent Unicode data.

The following program displays the problem:

  let ic = open_in path in
  let len = in_channel_length ic in
  let s = really_input_string ic len in
  close_in ic;
  Cstruct.of_string s

let () =
  "tests/keys/p256v1_explicit_param.der"
  |> read_cstruct
  |> Key_parsers.Asn1.EC.Params.decode
  |> Rresult.R.get_ok 
  |> Key_parsers.Asn1.EC.Params.to_yojson 
  |> Yojson.Safe.pretty_to_string 
  |> print_endline

This can be built as:

 % ocamlfind ocamlopt -package key-parsers -package yojson -package rresult -linkpkg dump.ml
 % ./a.out > out.json
 % python3 -mjson.tool out.json 
'utf-8' codec can't decode byte 0xff in position 180: invalid start byte

My suggestion is to use hex encoding prefixed with 0x. A more space-efficient alternative is to use base64 but this makes the output JSON less readable, and EC parameters are usually bounded in size anyway.

I'm happy to provide a patch if that's good with you.

Thanks!

bin_prot: new release requires adaptation

See: ocaml/opam-repository#8777 for an upper bound placed on ppx_bin_prot due to a compilation failure of key-parsers.0.7

The migration and fix is described in janestreet/bin_prot#14 if you want to support the latest version of Core, which is being currently being tested for merge. Existing releases will not break in stable opam, since the upper bound placed ensures that they use the old ppx_bin_prot.

.cmx files are not installed

In 4.03 the following warning is emitted when key-parsers is linked in:

Warning 58: no cmx file was found in path for module Key_parsers, and its interface was not compiled with -opaque

You can fix it either by adding true: opaque or installing the .cmx files (preferred). topkg will do this automatically if you want to give it a try :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.