Clone and build libprotobuf-mutator:
$ git clone https://github.com/google/libprotobuf-mutator.git libprotobuf-mutator
$ cd libprotobuf-mutator
$ mkdir build && cd build
$ cmake .. -GNinja -DLIB_PROTO_MUTATOR_DOWNLOAD_PROTOBUF=ON -DLIB_PROTO_MUTATOR_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
$ ninjaClone google-fuzzing and build test files:
$ git clone https://github.com/google/fuzzing.git fuzzing
$ cd fuzzing/proto/tests
$ make
Generate python files:
$ protoc ../asn1-pdu/*.proto --python_out=../asn1-pduGenerate a test certificate and convert it to the DER format:
$ openssl req -nodes -new -x509 -keyout key.pem -out cert.pem
$ openssl x509 -in cert.pem -out cert.der -outform DERConvert it to protobuf:
$ ./x509_to_protobuf.py cert.pem cert.protoConvert the protobuf back to DER:
$ ./protobuf_to_der.o cert.proto cert-2.derMake sure OpenSSL can properly parse the certificate and compare it to the initial one:
$ openssl x509 -inform DER -in cert-2.der -noout -text
$ openssl x509 -inform DER -in cert.der -noout -text