Create Account

REST Api operation to create an account which can store Record IDs.

Synopsis

Submit

PUT /<RESTServletPath>/<AccountID>.key HTTP/1.1
Host: <RESTHost:RESTPort>
Content-Length: <ContentLength>

Fields:

RESTServletPath
Path to the REST Servlet on the host. Example: records
RESTHost
IP address of Shared Records server. Example: sra.sharedrecords.org
RESTPort
Network port of the Shared Records server. Example: 8080 (default 80)
AccountID
The Account ID is the SHA1 hash of the attached public key.

Headers:

Content-Length
The size of the public key data, in bytes. (Required)

Body:

The body of the http-put should contain the raw bytes of the public key to be used with the account. Records shared with this account will use the public key to encrypt the data.

Response

HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Content-Type: text/html; charset=iso-8859-1
Content-Length: 0

Examples

Command-line

The following command-line example uses the common unix utilities "openssl" and "curl" to first generate a public key from a symmetric key, then create an account on the Shared Records server with the public key.

$ openssl genrsa -out mykey.pem 2048

$ openssl rsa -in mykey.pem -pubout -out mypubkey.pem

$ openssl dgst -sha1 mypubkey.pem 
SHA1(mypubkey.pem)= 0fac9064d257da8d81e7de1c936db2302430328b

$ curl --upload-file mypubkey.pem \
http://sra.sharedrecords.org/records/0fac9064d257da8d81e7de1c936db2302430328b.key

Note: the "\" character is used to indicate that the line continues. To copy-and-paste this command, remove those characters and remove whitespace in the URI.

Notes

  • The id of the account will be the SHA-1 hash of the public key. If this is not the case the operation will fail with 412 (precondition failed).