Skip to content
This repository has been archived by the owner. It is now read-only.
Ruby wrapper of API of the ekey.ru
Branch: master
Clone or download
Latest commit 428df09 Feb 1, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.gitignore
CODE-OF-CONDUCT.md Fix readme by pattern Feb 1, 2019
CONTRIBUTING.md Fix readme by pattern Feb 1, 2019
Gemfile Initial commit. Mar 12, 2012
LICENSE Fix readme by pattern Feb 1, 2019
README.md Fix readme by pattern Feb 1, 2019
Rakefile Initial commit. Mar 12, 2012
ekey.gemspec

README.md

PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED

Ekey

A ruby wrapper for API of the ekey.ru

Sponsored by Evrone

Getting Started

Installation

Add this line to your application's Gemfile:

gem 'ekey'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ekey

Usage

api_key setup

First of all, setup api_key. To do this, put a file ekey.rb into rails config/initializers directory.

Ekey::Config.api_key = <your_api_key>

If you aren't using rails, just make shure, api_key fills in before any API methods calls.

Sending certificate request

To send certificate request (csr) to the certificate authority CA, use the CSR.issue method

Ekey::Certificate.issue(csr)

Where the csr parameter is the signed certificate request in the pem format. Here is shortened example of the csr in pem format:

-----BEGIN CERTIFICATE REQUEST-----\nMIICTzCCAfwCAQAwggFEMT0wOwYDVQQDHjQEEAQ7BDUEOgRBBDAEPQQ0BEAAIAQfBDAEMgQ7BD4EMgQ4BEcAIAQSBDAEMgQ4BDsEPgQyMRUwEwYYVQUHHgwGHPQ\n-----END CERTIFICATE REQUEST-----

Result: a ruby Hash, in format: {"created_request_id" => <number>} or {"error" => <message>}.

Getting issued certificates by request ids

In order to get issued certificates use

Ekey::Certificate.get_certificates(request_ids)

Where request_ids is a collection of all request ids of the pending certificates in your application. It can be a String, Array or just one Fixnum.

Response: a JSON in format [{"id" => <request_id>, "certificate" => <certificate_body>}], or if the certificate is'n issued yet - [{"id" => <request_id>, "error" => "certificate is not ready yet"}]. Response can contain both of this as well.

Note, that certificate is the only base64 string without BEGIN CERTIFICATE/END CERTIFICATE splitted by 64 characters. Here is the shortened sample of the certificate value:

MIIDZjCCAxOgAwIBAgIKXaz9BwAAAADF1jAKBgYqhQMCAgMFADCBkjEeMBwGCSqG\nSIb3DQEJARYPY29udGFjdEBla2V5LnJ1MQswCQYDVQQGEwJSVTEVMBMGA1UEBwwM\n0JzQvtGB0LrQstCwMTcwNQYDVQQKn8HsQFSfy9BDG+A==\n

Contributing

Please read Code of Conduct and Contributing Guidelines for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License.

You can’t perform that action at this time.