rnp 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +5 -0
- data/LICENSE.txt +21 -0
- data/README.adoc +3 -182
- data/lib/rnp.rb +12 -3
- data/lib/rnp/error.rb +40 -0
- data/lib/rnp/ffi/librnp.rb +306 -0
- data/lib/rnp/input.rb +99 -0
- data/lib/rnp/key.rb +275 -0
- data/lib/rnp/misc.rb +71 -0
- data/lib/rnp/op/encrypt.rb +181 -0
- data/lib/rnp/op/sign.rb +139 -0
- data/lib/rnp/op/verify.rb +147 -0
- data/lib/rnp/output.rb +121 -0
- data/lib/rnp/rnp.rb +595 -0
- data/lib/rnp/utils.rb +44 -0
- data/lib/rnp/version.rb +8 -3
- metadata +124 -50
- data/.gitignore +0 -12
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -4
- data/Rakefile +0 -6
- data/Use_Cases.adoc +0 -119
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/example-usage.rb +0 -766
- data/examples/highlevel/decrypt_mem.rb +0 -44
- data/examples/highlevel/encrypt_mem.rb +0 -46
- data/examples/lowlevel/decrypt_file.rb +0 -76
- data/examples/lowlevel/decrypt_mem.rb +0 -80
- data/examples/lowlevel/encrypt_file.rb +0 -68
- data/examples/lowlevel/encrypt_mem.rb +0 -75
- data/examples/lowlevel/load_pubkey.rb +0 -118
- data/examples/lowlevel/print_keyring_file.rb +0 -68
- data/examples/lowlevel/print_keyring_mem.rb +0 -96
- data/examples/lowlevel/sign_file.rb +0 -104
- data/examples/lowlevel/sign_mem.rb +0 -96
- data/examples/lowlevel/verify_file.rb +0 -55
- data/examples/lowlevel/verify_mem.rb +0 -61
- data/lib/rnp/highlevel.rb +0 -5
- data/lib/rnp/highlevel/constants.rb +0 -96
- data/lib/rnp/highlevel/keyring.rb +0 -259
- data/lib/rnp/highlevel/publickey.rb +0 -150
- data/lib/rnp/highlevel/secretkey.rb +0 -318
- data/lib/rnp/highlevel/utils.rb +0 -119
- data/lib/rnp/lowlevel.rb +0 -6
- data/lib/rnp/lowlevel/constants.rb +0 -11
- data/lib/rnp/lowlevel/dynarray.rb +0 -129
- data/lib/rnp/lowlevel/enums.rb +0 -243
- data/lib/rnp/lowlevel/libc.rb +0 -28
- data/lib/rnp/lowlevel/libopenssl.rb +0 -15
- data/lib/rnp/lowlevel/librnp.rb +0 -213
- data/lib/rnp/lowlevel/structs.rb +0 -541
- data/lib/rnp/lowlevel/utils.rb +0 -25
- data/rnp.gemspec +0 -35
- data/rnp/lib/rnp.rb +0 -5
- data/rnp/spec/rnp_spec.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 819cdabaf35f30cd1ab40367c4f1ac1e737f00ed
|
4
|
+
data.tar.gz: 4ef0f37aa752856fdff385d5008d0fd1c64b8846
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 571f718f9d06e6b5b796b2d867af8edb0a4e36ebb09d7db52e40c93582998761c271d93b10306378e73823fce0a604c11954cb855ee5ce05915dc7de49e14299
|
7
|
+
data.tar.gz: c42de97ae72fb766073073d4080f36e9b93cae4a558a53b5a05377eaf946d7abc45ffe9c32f1f683b41275da78ba5abaa8ceb4f08f7474db8ca60f95fa56e381
|
data/CHANGELOG.adoc
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Ribose Inc.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.adoc
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
= Ruby RNP bindings
|
2
2
|
|
3
|
+
image:https://img.shields.io/travis/riboseinc/ruby-rnp/master.svg["Build Status", link="https://travis-ci.org/riboseinc/ruby-rnp"]
|
4
|
+
image:https://codecov.io/github/riboseinc/ruby-rnp/coverage.svg["Code Coverage", link="https://codecov.io/github/riboseinc/ruby-rnp?branch=master"]
|
5
|
+
|
3
6
|
The `rnp` gem provides Ruby bindings to the
|
4
7
|
https://github.com/riboseinc/rnp[librnp OpenPGP library].
|
5
8
|
|
@@ -24,185 +27,3 @@ Or install it yourself as:
|
|
24
27
|
gem install rnp
|
25
28
|
----
|
26
29
|
|
27
|
-
|
28
|
-
== Overview
|
29
|
-
|
30
|
-
The code is split in to two main modules.
|
31
|
-
|
32
|
-
* low-level binding code is in the module `LibRNP` (`lib/rnp/lowlevel/`).
|
33
|
-
|
34
|
-
* high-level wrapper is in the module `RNP` (`lib/rnp/highlevel/`).
|
35
|
-
|
36
|
-
|
37
|
-
== Usage
|
38
|
-
|
39
|
-
=== Loading Keys
|
40
|
-
|
41
|
-
[source,ruby]
|
42
|
-
----
|
43
|
-
require 'rnp'
|
44
|
-
keyring = RNP::Keyring.load(File.read('spec/keys/seckey_sign_only.asc'))
|
45
|
-
# load some more keys in to this keyring
|
46
|
-
keyring.add(File.read('spec/keys/pubkey_sign_only.asc'))
|
47
|
-
# access public keys
|
48
|
-
keyring.public_keys
|
49
|
-
# access secret keys
|
50
|
-
keyring.secret_keys
|
51
|
-
----
|
52
|
-
|
53
|
-
=== Generating Keys
|
54
|
-
|
55
|
-
[source,ruby]
|
56
|
-
----
|
57
|
-
key = RNP::SecretKey.generate('mypassphrase', {
|
58
|
-
key_length: 1024,
|
59
|
-
public_key_algorithm: RNP::PublicKeyAlgorithm::RSA,
|
60
|
-
algorithm_params: {e: 65537},
|
61
|
-
hash_algorithm: RNP::HashAlgorithm::SHA1,
|
62
|
-
symmetric_key_algorithm: RNP::SymmetricKeyAlgorithm::CAST5
|
63
|
-
})
|
64
|
-
|
65
|
-
# Note that the passphrase of the parent key will be used, so pass an
|
66
|
-
# empty string here.
|
67
|
-
|
68
|
-
# Also note that we are only providing the key_Length option here, so
|
69
|
-
# defaults will be used.
|
70
|
-
subkey = RNP::SecretKey.generate('', { key_length: 1024 })
|
71
|
-
key.add_subkey(subkey)
|
72
|
-
----
|
73
|
-
|
74
|
-
=== Unlocking Secret Keys
|
75
|
-
|
76
|
-
Most secret keys are encrypted and require a passphrase for certain
|
77
|
-
operations. This can be provided during keyring loading by providing a
|
78
|
-
block, like so:
|
79
|
-
|
80
|
-
[source,ruby]
|
81
|
-
----
|
82
|
-
keyring = RNP::Keyring.load(File.read('spec/keys/seckey_sign_only.asc')) {|seckey|
|
83
|
-
# This block will be called for each encrypted key that is found
|
84
|
-
# during parsing.
|
85
|
-
# An instance of SecretKey is passed.
|
86
|
-
print "Enter passphrase for key #{seckey.key_id_hex}: "
|
87
|
-
$stdin.gets.chomp
|
88
|
-
}
|
89
|
-
----
|
90
|
-
|
91
|
-
The above method will result in fully unlocked SecretKey instances that
|
92
|
-
have `@passphrase` set correctly (and have decrypted key material in
|
93
|
-
`@mpi`).
|
94
|
-
|
95
|
-
Alternatively, you can manually set `@passphrase` on a secret key to
|
96
|
-
enable operations that require a passphrase. In this case, the key
|
97
|
-
material in `@mpi` will have nil values, but the encrypted key material
|
98
|
-
will be available in `@raw_subpackets` and used for operations requiring
|
99
|
-
it.
|
100
|
-
|
101
|
-
[source,ruby]
|
102
|
-
----
|
103
|
-
secret_key = keyring.secret_keys[0]
|
104
|
-
secret_key.passphrase = 'password'
|
105
|
-
# decrypt, sign, etc.
|
106
|
-
----
|
107
|
-
|
108
|
-
=== Encryption and Decryption
|
109
|
-
|
110
|
-
Encryption is done with a `PublicKey`.
|
111
|
-
|
112
|
-
[source,ruby]
|
113
|
-
----
|
114
|
-
public_key = keyring.public_keys[0]
|
115
|
-
encrypted_message = public_key.encrypt('Test')
|
116
|
-
----
|
117
|
-
|
118
|
-
Decryption is done with the corresponding `SecretKey`.
|
119
|
-
|
120
|
-
[source,ruby]
|
121
|
-
----
|
122
|
-
# find the secret key that corresponds with the above public key
|
123
|
-
secret_key = keyring.secret_keys.find { |key|
|
124
|
-
key.key_id_hex == public_key.key_id_hex
|
125
|
-
}
|
126
|
-
|
127
|
-
# decrypt (note that secret_key.passphrase must be correctly set, if
|
128
|
-
# required)
|
129
|
-
secret_key.decrypt(encrypted_message)
|
130
|
-
----
|
131
|
-
|
132
|
-
=== Signing and Verifying
|
133
|
-
|
134
|
-
Signing is done with a SecretKey, like so:
|
135
|
-
|
136
|
-
[source,ruby]
|
137
|
-
----
|
138
|
-
signed_message = secret_key.sign('My Data')
|
139
|
-
----
|
140
|
-
|
141
|
-
Verification is done with a Keyring.
|
142
|
-
|
143
|
-
[source,ruby]
|
144
|
-
----
|
145
|
-
# returns true or false
|
146
|
-
keyring.verify(signed_message)
|
147
|
-
----
|
148
|
-
|
149
|
-
=== Exporting
|
150
|
-
|
151
|
-
Keys can be exported by using the Keyring::export function.
|
152
|
-
|
153
|
-
[source,ruby]
|
154
|
-
----
|
155
|
-
# this will output an ASCII-armored private key
|
156
|
-
puts keyring.export(secret_key)
|
157
|
-
|
158
|
-
# a secret key also has a public key inside
|
159
|
-
puts keyring.export(secret_key.public_key)
|
160
|
-
----
|
161
|
-
|
162
|
-
== Documentation
|
163
|
-
|
164
|
-
Run "yardoc" to generate documentation in the `doc/` directory.
|
165
|
-
|
166
|
-
[source,sh]
|
167
|
-
----
|
168
|
-
$ yardoc
|
169
|
-
----
|
170
|
-
|
171
|
-
|
172
|
-
== Tests
|
173
|
-
|
174
|
-
Run "rake" or "rspec" to run all tests in the `spec/` directory.
|
175
|
-
|
176
|
-
[source,sh]
|
177
|
-
----
|
178
|
-
$ rake
|
179
|
-
----
|
180
|
-
|
181
|
-
**Note**: Some of the tests generate keys and thus will consume entropy.
|
182
|
-
|
183
|
-
== Examples
|
184
|
-
|
185
|
-
There are examples demonstrating the use of both the low-level and
|
186
|
-
high-level interfaces in `examples/`.
|
187
|
-
|
188
|
-
|
189
|
-
== Development
|
190
|
-
|
191
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
192
|
-
Then, run `rake spec` to run the tests. You can also run `bin/console`
|
193
|
-
for an interactive prompt that will allow you to experiment.
|
194
|
-
|
195
|
-
To install this gem onto your local machine, run `bundle exec rake
|
196
|
-
install`. To release a new version, update the version number in
|
197
|
-
`version.rb`, and then run `bundle exec rake release`, which will create
|
198
|
-
a git tag for the version, push git commits and tags, and push the
|
199
|
-
`.gem` file to https://rubygems.org(rubygems.org).
|
200
|
-
|
201
|
-
== Contributing
|
202
|
-
|
203
|
-
Bug reports and pull requests are welcome on GitHub at
|
204
|
-
https://github.com/riboseinc/ruby-rnp. This project is intended to be a
|
205
|
-
safe, welcoming space for collaboration, and contributors are expected
|
206
|
-
to adhere to the http://contributor-covenant.org[Contributor Covenant]
|
207
|
-
code of conduct.
|
208
|
-
|
data/lib/rnp.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# (c) 2018 Ribose Inc.
|
4
|
+
|
5
|
+
require 'rnp/error'
|
6
|
+
require 'rnp/input'
|
7
|
+
require 'rnp/misc'
|
8
|
+
require 'rnp/op/encrypt'
|
9
|
+
require 'rnp/op/sign'
|
10
|
+
require 'rnp/op/verify'
|
11
|
+
require 'rnp/output'
|
12
|
+
require 'rnp/rnp'
|
13
|
+
require 'rnp/version'
|
5
14
|
|
data/lib/rnp/error.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (c) 2018 Ribose Inc.
|
4
|
+
|
5
|
+
require 'rnp/ffi/librnp'
|
6
|
+
|
7
|
+
class Rnp
|
8
|
+
class Error < ::StandardError
|
9
|
+
attr_reader :rc
|
10
|
+
|
11
|
+
def initialize(msg, rc = nil)
|
12
|
+
@rc = rc
|
13
|
+
if rc
|
14
|
+
desc = LibRnp.rnp_result_to_string(rc)
|
15
|
+
msg = "#{msg} - (rc: 0x#{rc.to_s(16)}): #{desc}"
|
16
|
+
end
|
17
|
+
super(msg)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class BadPasswordError < Error; end
|
22
|
+
class InvalidSignatureError < Error; end
|
23
|
+
class BadFormatError < Error; end
|
24
|
+
class NoSuitableKeyError < Error; end
|
25
|
+
|
26
|
+
# @api private
|
27
|
+
def self.raise_error(msg, rc = nil)
|
28
|
+
klass = ERRORS_MAP.fetch(rc, Error)
|
29
|
+
raise klass.new(msg, rc)
|
30
|
+
end
|
31
|
+
|
32
|
+
# @api private
|
33
|
+
ERRORS_MAP = {
|
34
|
+
LibRnp::RNP_ERROR_BAD_PASSWORD => BadPasswordError,
|
35
|
+
LibRnp::RNP_ERROR_SIGNATURE_INVALID => InvalidSignatureError,
|
36
|
+
LibRnp::RNP_ERROR_BAD_FORMAT => BadFormatError,
|
37
|
+
LibRnp::RNP_ERROR_NO_SUITABLE_KEY => NoSuitableKeyError
|
38
|
+
}.freeze
|
39
|
+
end # class
|
40
|
+
|
@@ -0,0 +1,306 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# (c) 2018 Ribose Inc.
|
4
|
+
|
5
|
+
require 'ffi'
|
6
|
+
|
7
|
+
# @api private
|
8
|
+
module LibRnp
|
9
|
+
extend FFI::Library
|
10
|
+
ffi_lib 'rnp'
|
11
|
+
|
12
|
+
callback :rnp_get_key_cb,
|
13
|
+
%i[pointer pointer string string bool],
|
14
|
+
:void
|
15
|
+
callback :rnp_password_cb,
|
16
|
+
%i[pointer pointer pointer string pointer size_t],
|
17
|
+
:bool
|
18
|
+
callback :rnp_input_reader_t,
|
19
|
+
%i[pointer pointer size_t],
|
20
|
+
:ssize_t
|
21
|
+
callback :rnp_output_writer_t,
|
22
|
+
%i[pointer pointer size_t],
|
23
|
+
:bool
|
24
|
+
|
25
|
+
attach_function :rnp_result_to_string,
|
26
|
+
%i[uint32],
|
27
|
+
:string
|
28
|
+
attach_function :rnp_ffi_create,
|
29
|
+
%i[pointer string string],
|
30
|
+
:uint32
|
31
|
+
attach_function :rnp_ffi_destroy,
|
32
|
+
%i[pointer],
|
33
|
+
:uint32
|
34
|
+
attach_function :rnp_ffi_set_log_fd,
|
35
|
+
%i[pointer int],
|
36
|
+
:uint32
|
37
|
+
attach_function :rnp_ffi_set_key_provider,
|
38
|
+
%i[pointer rnp_get_key_cb pointer],
|
39
|
+
:uint32
|
40
|
+
attach_function :rnp_ffi_set_pass_provider,
|
41
|
+
%i[pointer rnp_password_cb pointer],
|
42
|
+
:uint32
|
43
|
+
attach_function :rnp_get_default_homedir,
|
44
|
+
%i[pointer],
|
45
|
+
:uint32
|
46
|
+
attach_function :rnp_detect_homedir_info,
|
47
|
+
%i[string pointer pointer pointer pointer],
|
48
|
+
:uint32
|
49
|
+
attach_function :rnp_detect_key_format,
|
50
|
+
%i[pointer int pointer],
|
51
|
+
:uint32
|
52
|
+
attach_function :rnp_load_keys,
|
53
|
+
%i[pointer string pointer uint32],
|
54
|
+
:uint32
|
55
|
+
attach_function :rnp_save_keys,
|
56
|
+
%i[pointer string pointer uint32],
|
57
|
+
:uint32
|
58
|
+
attach_function :rnp_get_public_key_count,
|
59
|
+
%i[pointer pointer],
|
60
|
+
:uint32
|
61
|
+
attach_function :rnp_get_secret_key_count,
|
62
|
+
%i[pointer pointer],
|
63
|
+
:uint32
|
64
|
+
attach_function :rnp_locate_key,
|
65
|
+
%i[pointer string string pointer],
|
66
|
+
:uint32
|
67
|
+
attach_function :rnp_key_handle_destroy,
|
68
|
+
%i[pointer],
|
69
|
+
:uint32
|
70
|
+
attach_function :rnp_generate_key_json,
|
71
|
+
%i[pointer string pointer],
|
72
|
+
:uint32
|
73
|
+
attach_function :rnp_key_get_primary_uid,
|
74
|
+
%i[pointer pointer],
|
75
|
+
:uint32
|
76
|
+
attach_function :rnp_key_get_uid_count,
|
77
|
+
%i[pointer pointer],
|
78
|
+
:uint32
|
79
|
+
attach_function :rnp_key_get_uid_at,
|
80
|
+
%i[pointer int pointer],
|
81
|
+
:uint32
|
82
|
+
attach_function :rnp_key_add_uid,
|
83
|
+
%i[pointer string string uint32 uint8 int],
|
84
|
+
:uint32
|
85
|
+
attach_function :rnp_key_get_fprint,
|
86
|
+
%i[pointer pointer],
|
87
|
+
:uint32
|
88
|
+
attach_function :rnp_key_get_keyid,
|
89
|
+
%i[pointer pointer],
|
90
|
+
:uint32
|
91
|
+
attach_function :rnp_key_get_grip,
|
92
|
+
%i[pointer pointer],
|
93
|
+
:uint32
|
94
|
+
attach_function :rnp_key_is_locked,
|
95
|
+
%i[pointer pointer],
|
96
|
+
:uint32
|
97
|
+
attach_function :rnp_key_lock,
|
98
|
+
%i[pointer],
|
99
|
+
:uint32
|
100
|
+
attach_function :rnp_key_unlock,
|
101
|
+
%i[pointer pointer],
|
102
|
+
:uint32
|
103
|
+
attach_function :rnp_key_is_protected,
|
104
|
+
%i[pointer pointer],
|
105
|
+
:uint32
|
106
|
+
attach_function :rnp_key_protect,
|
107
|
+
%i[pointer string string string string size_t],
|
108
|
+
:uint32
|
109
|
+
attach_function :rnp_key_unprotect,
|
110
|
+
%i[pointer string],
|
111
|
+
:uint32
|
112
|
+
attach_function :rnp_key_is_primary,
|
113
|
+
%i[pointer pointer],
|
114
|
+
:uint32
|
115
|
+
attach_function :rnp_key_is_sub,
|
116
|
+
%i[pointer pointer],
|
117
|
+
:uint32
|
118
|
+
attach_function :rnp_key_have_secret,
|
119
|
+
%i[pointer pointer],
|
120
|
+
:uint32
|
121
|
+
attach_function :rnp_key_have_public,
|
122
|
+
%i[pointer pointer],
|
123
|
+
:uint32
|
124
|
+
attach_function :rnp_op_sign_create,
|
125
|
+
%i[pointer pointer pointer pointer],
|
126
|
+
:uint32
|
127
|
+
attach_function :rnp_op_sign_cleartext_create,
|
128
|
+
%i[pointer pointer pointer pointer],
|
129
|
+
:uint32
|
130
|
+
attach_function :rnp_op_sign_detached_create,
|
131
|
+
%i[pointer pointer pointer pointer],
|
132
|
+
:uint32
|
133
|
+
attach_function :rnp_op_sign_add_signature,
|
134
|
+
%i[pointer pointer pointer],
|
135
|
+
:uint32
|
136
|
+
attach_function :rnp_op_sign_signature_set_hash,
|
137
|
+
%i[pointer string],
|
138
|
+
:uint32
|
139
|
+
attach_function :rnp_op_sign_signature_set_creation_time,
|
140
|
+
%i[pointer uint32],
|
141
|
+
:uint32
|
142
|
+
attach_function :rnp_op_sign_signature_set_expiration_time,
|
143
|
+
%i[pointer uint32],
|
144
|
+
:uint32
|
145
|
+
attach_function :rnp_op_sign_set_compression,
|
146
|
+
%i[pointer string int],
|
147
|
+
:uint32
|
148
|
+
attach_function :rnp_op_sign_set_armor,
|
149
|
+
%i[pointer bool],
|
150
|
+
:uint32
|
151
|
+
attach_function :rnp_op_sign_set_hash,
|
152
|
+
%i[pointer string],
|
153
|
+
:uint32
|
154
|
+
attach_function :rnp_op_sign_set_creation_time,
|
155
|
+
%i[pointer uint32],
|
156
|
+
:uint32
|
157
|
+
attach_function :rnp_op_sign_set_expiration_time,
|
158
|
+
%i[pointer uint32],
|
159
|
+
:uint32
|
160
|
+
attach_function :rnp_op_sign_execute,
|
161
|
+
%i[pointer],
|
162
|
+
:uint32
|
163
|
+
attach_function :rnp_op_sign_destroy,
|
164
|
+
%i[pointer],
|
165
|
+
:uint32
|
166
|
+
attach_function :rnp_op_verify_create,
|
167
|
+
%i[pointer pointer pointer pointer],
|
168
|
+
:uint32
|
169
|
+
attach_function :rnp_op_verify_detached_create,
|
170
|
+
%i[pointer pointer pointer pointer],
|
171
|
+
:uint32
|
172
|
+
attach_function :rnp_op_verify_execute,
|
173
|
+
%i[pointer],
|
174
|
+
:uint32
|
175
|
+
attach_function :rnp_op_verify_get_signature_count,
|
176
|
+
%i[pointer pointer],
|
177
|
+
:uint32
|
178
|
+
attach_function :rnp_op_verify_get_signature_at,
|
179
|
+
%i[pointer int pointer],
|
180
|
+
:uint32
|
181
|
+
attach_function :rnp_op_verify_get_file_info,
|
182
|
+
%i[pointer pointer pointer],
|
183
|
+
:uint32
|
184
|
+
attach_function :rnp_op_verify_destroy,
|
185
|
+
%i[pointer],
|
186
|
+
:uint32
|
187
|
+
attach_function :rnp_op_verify_signature_get_status,
|
188
|
+
%i[pointer],
|
189
|
+
:uint32
|
190
|
+
attach_function :rnp_op_verify_signature_get_hash,
|
191
|
+
%i[pointer pointer],
|
192
|
+
:uint32
|
193
|
+
attach_function :rnp_op_verify_signature_get_key,
|
194
|
+
%i[pointer pointer],
|
195
|
+
:uint32
|
196
|
+
attach_function :rnp_op_verify_signature_get_times,
|
197
|
+
%i[pointer pointer pointer],
|
198
|
+
:uint32
|
199
|
+
attach_function :rnp_buffer_destroy,
|
200
|
+
%i[pointer],
|
201
|
+
:void
|
202
|
+
attach_function :rnp_input_from_path,
|
203
|
+
%i[pointer string],
|
204
|
+
:uint32
|
205
|
+
attach_function :rnp_input_from_memory,
|
206
|
+
%i[pointer pointer int bool],
|
207
|
+
:uint32
|
208
|
+
attach_function :rnp_input_from_callback,
|
209
|
+
%i[pointer rnp_input_reader_t pointer pointer],
|
210
|
+
:uint32
|
211
|
+
attach_function :rnp_input_destroy,
|
212
|
+
%i[pointer],
|
213
|
+
:uint32
|
214
|
+
attach_function :rnp_output_to_path,
|
215
|
+
%i[pointer string],
|
216
|
+
:uint32
|
217
|
+
attach_function :rnp_output_to_memory,
|
218
|
+
%i[pointer int],
|
219
|
+
:uint32
|
220
|
+
attach_function :rnp_output_memory_get_buf,
|
221
|
+
%i[pointer pointer pointer bool],
|
222
|
+
:uint32
|
223
|
+
attach_function :rnp_output_to_callback,
|
224
|
+
%i[pointer rnp_output_writer_t pointer pointer],
|
225
|
+
:uint32
|
226
|
+
attach_function :rnp_output_to_null,
|
227
|
+
%i[pointer],
|
228
|
+
:uint32
|
229
|
+
attach_function :rnp_output_destroy,
|
230
|
+
%i[pointer],
|
231
|
+
:uint32
|
232
|
+
attach_function :rnp_op_encrypt_create,
|
233
|
+
%i[pointer pointer pointer pointer],
|
234
|
+
:uint32
|
235
|
+
attach_function :rnp_op_encrypt_add_recipient,
|
236
|
+
%i[pointer pointer],
|
237
|
+
:uint32
|
238
|
+
attach_function :rnp_op_encrypt_add_signature,
|
239
|
+
%i[pointer pointer pointer],
|
240
|
+
:uint32
|
241
|
+
attach_function :rnp_op_encrypt_set_hash,
|
242
|
+
%i[pointer string],
|
243
|
+
:uint32
|
244
|
+
attach_function :rnp_op_encrypt_set_creation_time,
|
245
|
+
%i[pointer uint32],
|
246
|
+
:uint32
|
247
|
+
attach_function :rnp_op_encrypt_set_expiration_time,
|
248
|
+
%i[pointer uint32],
|
249
|
+
:uint32
|
250
|
+
attach_function :rnp_op_encrypt_add_password,
|
251
|
+
%i[pointer string string int string],
|
252
|
+
:uint32
|
253
|
+
attach_function :rnp_op_encrypt_set_armor,
|
254
|
+
%i[pointer bool],
|
255
|
+
:uint32
|
256
|
+
attach_function :rnp_op_encrypt_set_cipher,
|
257
|
+
%i[pointer string],
|
258
|
+
:uint32
|
259
|
+
attach_function :rnp_op_encrypt_set_compression,
|
260
|
+
%i[pointer string int],
|
261
|
+
:uint32
|
262
|
+
attach_function :rnp_op_encrypt_execute,
|
263
|
+
%i[pointer],
|
264
|
+
:uint32
|
265
|
+
attach_function :rnp_op_encrypt_destroy,
|
266
|
+
%i[pointer],
|
267
|
+
:uint32
|
268
|
+
attach_function :rnp_decrypt,
|
269
|
+
%i[pointer pointer pointer],
|
270
|
+
:uint32
|
271
|
+
attach_function :rnp_get_public_key_data,
|
272
|
+
%i[pointer pointer pointer],
|
273
|
+
:uint32
|
274
|
+
attach_function :rnp_get_secret_key_data,
|
275
|
+
%i[pointer pointer pointer],
|
276
|
+
:uint32
|
277
|
+
attach_function :rnp_key_to_json,
|
278
|
+
%i[pointer uint32 pointer],
|
279
|
+
:uint32
|
280
|
+
attach_function :rnp_identifier_iterator_create,
|
281
|
+
%i[pointer pointer string],
|
282
|
+
:uint32
|
283
|
+
attach_function :rnp_identifier_iterator_next,
|
284
|
+
%i[pointer pointer],
|
285
|
+
:uint32
|
286
|
+
attach_function :rnp_identifier_iterator_destroy,
|
287
|
+
%i[pointer],
|
288
|
+
:uint32
|
289
|
+
|
290
|
+
|
291
|
+
RNP_LOAD_SAVE_PUBLIC_KEYS = (1 << 0)
|
292
|
+
RNP_LOAD_SAVE_SECRET_KEYS = (1 << 1)
|
293
|
+
|
294
|
+
RNP_JSON_PUBLIC_MPIS = (1 << 0)
|
295
|
+
RNP_JSON_SECRET_MPIS = (1 << 1)
|
296
|
+
RNP_JSON_SIGNATURES = (1 << 2)
|
297
|
+
RNP_JSON_SIGNATURE_MPIS = (1 << 3)
|
298
|
+
|
299
|
+
RNP_SUCCESS = 0
|
300
|
+
RNP_ERROR_BAD_FORMAT = 0x10000001
|
301
|
+
RNP_ERROR_SIGNATURE_INVALID = 0x12000002
|
302
|
+
RNP_ERROR_BAD_PASSWORD = 0x12000004
|
303
|
+
RNP_ERROR_NO_SUITABLE_KEY = 0x12000006
|
304
|
+
RNP_ERROR_SIGNATURE_EXPIRED = 0x1200000B
|
305
|
+
end # module
|
306
|
+
|