Git Product home page Git Product logo

sigadd's Introduction

SigAdd

This script allows Signing Entities to submit content signatures for inclusion in the api

###Requirements

####OpenSSL This tool requires the SHA384 hash algorithm which is available in OpenSSL 1.0.1.e and newer. If your version of OpenSSL does not support the correct hash algorithm you will likely receive an error message as shown below

$ Error Verifying Data
$ 10308:error:0606C06E:digital envelope routines:EVP_VerifyFinal:wrong public key type:.\crypto\evp\p_verify.c:85:

When debugging this tool always make sure you have the correct version of OpenSSL first.

###Example

First start up the script with your desired port

$ python index.py 88

The service will now be listening at 127.0.0.1:88

Given the following data below:

{
  "content": "https://api.unfoldingword.org/obs/txt/1/en/obs-en.json?date_modified=20150210",
  "sig": "MGYCMQDN7R4lTqR579DwbEQjGa7gBDlQrqv84fv7EPJoTC7XwYK0H2ODQ3UQL5QaOiE2+h0CMQC0JPChVkm8FbX+OhFNFl8D1bp96dMpdE6XOchCE0j/tDACWIQGV/icjbD4m5yb2Vk=",
  "slug": "uW"
}

Perform a post request to wherever the script is listening (127.0.0.1:88 in this example):

$ curl -X POST --data-urlencode "data=<data above with quotes escaped and no newlines>" http://127.0.0.1:88

e.g.

$ curl -X POST --data-urlencode "data={\"content\":\"https://api.unfoldingword.org/obs/txt/1/en/obs-en.json?date_modified=20150210\",\"sig\":\"MGYCMQDN7R4lTqR579DwbEQjGa7gBDlQrqv84fv7EPJoTC7XwYK0H2ODQ3UQL5QaOiE2+h0CMQC0JPChVkm8FbX+OhFNFl8D1bp96dMpdE6XOchCE0j/tDACWIQGV/icjbD4m5yb2Vk=\",\"slug\":\"uW\"}" http://127.0.0.1:88

Note: in production this script will be located at https://api.unfoldingword.org/sigadd/

sigadd's People

Contributors

da1nerd avatar

Watchers

Jesse Griffin avatar  avatar James Cloos avatar Del Hager avatar David Stone avatar  avatar Phil Hopper avatar  avatar K avatar Leo avatar

sigadd's Issues

Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/jesse/vcs/sigadd/index.py", line 53, in index
    check = checkSig(content, path, sig, slug)
  File "/home/jesse/vcs/sigadd/index.py", line 106, in checkSig
    com = Popen(command, shell=False, stdin=PIPE, stdout=PIPE, stderr=PIPE)
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Scripting Snippet

Include snippet, perhaps in README, that notes how to add a signature (correct JSON format, etc).

Add openssl verification

Command to verify:

/usr/local/bin/openssl dgst -sha384 -verify PUBLIC_KEY -signature SIGNATURE PAYLOAD

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.