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

Re: [Handle-info] hsj 8 challenge response "Authentication via Authorization: Handle" via HS_PUBKEY python example.



Is there a spot on the CNRI website where we, others, could upload code we've made to use the handle API, or link to our projects that include API tools?

I imagine that many, if not most, handle maintainers will be interested sooner or later in availing themselves of the API.

-- Scott

On 02/03/2016 02:46 PM, Robert R Tupelo-Schneck wrote:
First of all, use the hdl-convert-key utility to produce a standard PEM file for the handle private key file.  (That way you can take advantage of key-decoding functionality from a standard library.)

I've attached a Python example written by my colleague Ben Hadden.  It uses "requests" and "PyCrypto".  It resolves a handle record, changes the data in the handle value at index 1, and updates the handle record.  Change the values in the main() function at the top to reflect your actual situation.

The updateHandleRecord() function does the work.  It sends an unauthenticated PUT request, parses the WWW-Authenticate: header from the response to that, constructs an Authorization: header, and sends the request again authenticated.

Let us know if you have any questions!

Robert





On Feb 2, 2016, at 9:30 AM, Robert Verkerk <robert.verkerk@surfsara.nl> wrote:

Hi,

We want to use the handle rest-full api. But don’t want to use the basic authentication with HS_SECKEY.

Does anybody have an python example of challenge response  "Authentication via Authorization: Handle" using HS_PUBKEY?
We would like to generate a private/public keypair with hdl-keygen. The public key is stored in the handle database. The private key is known on the client.

We saw the handle technical manual chapter 14.6.4 and further. This shows the basics. But it is not enough to create a working piece of python code.

--
Greetings,

Robert Verkerk






_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info



_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info


--
Scott Prater
Shared Development Group
General Library System
University of Wisconsin - Madison

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
Handle-Info mailing list
Handle-Info@cnri.reston.va.us
http://www.handle.net/mailman/listinfo/handle-info