CyberplatPKI is an FFI binding for signing Cyberplat requests. It includes both Linux and Windows versions of Cyberplat-provided library as well as the necessary wrapping code.
Add this line to your application's Gemfile:
gem 'cyberplat_pki'
And then execute:
$ bundle
Or install it yourself as:
$ gem install cyberplat_pki
To sign:
privkey_serialized = File.read("private.key")
privkey = CyberplatPKI::Key.new_private(privkey_serialized, 'passphrase')
signed_data = privkey.sign(data)
To verify:
pubkey_serialized = File.read("public.key")
pubkey = CyberplatPKI::Key.new_public(pubkey_serialized, 12345) # serial = 12345
pubkey.verify(signed_data) # => true
Note that the library uses Windows line endings (\r\n
) internally. You must not touch those, or the library will fail. Treat the signed data as binary, or make sure to restore the expected line endings.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request