Class | GPGME::Key |
In: |
lib/gpgme/key.rb
ext/gpgme/gpgme_n.c |
Parent: | Object |
The CTX argument can be `NULL’. In that case, `gpgme_wait’ waits
for any context to complete its operation.
chain_id | [R] | |
issuer_name | [R] | |
issuer_serial | [R] | |
keylist_mode | [R] | |
owner_trust | [R] | |
protocol | [R] | |
subkeys | [R] | |
uids | [R] |
Exports public keys
GPGME::Key.export pattern, options
Private keys cannot be exported due to GPGME restrictions.
@param pattern
Identifier of the key to export.
@param [Hash] options
* +:output+ specify where to write the key to. It will be converted to a {GPGME::Data}, so it could be a file, for example. * Any other option accepted by {GPGME::Ctx.new}
@return [GPGME::Data] the exported key.
@example
key = GPGME::Key.export "mrsimo@example.com"
@example writing to a file
out = File.open("my.key", "w+") GPGME::Key.export "mrsimo@example.com", :output => out
Returns an array of {GPGME::Key} objects that match the parameters.
@example
GPGME::Key.find :secret # => first secret key found
@example
GPGME::Key.find(:public, "mrsimo@example.com") # => return only public keys that match mrsimo@example.com
@example
GPGME::Key.find(:public, "mrsimo@example.com", :sign) # => return the public keys that match mrsimo@example.com and are # capable of signing
Imports a key
GPGME::Key.import keydata, options
@param keydata
The key to import. It will be converted to a {GPGME::Data} object, so could be a file, for example.
@param options
Any other option accepted by {GPGME::Ctx.new}
@example
GPGME::Key.import(File.open("my.key"))
Delete this key. If it‘s public, and has a secret one it will fail unless allow_secret is specified as true.
Exports this key. Accepts the same options as {GPGME::Ctx.new}, and +options[:output]+, where you can specify something that can become a {GPGME::Data}, where the output will go.
@example
key.export(:armor => true) # => GPGME::Data you can read with ASCII armored format
@example
file = File.open("key.asc", "w+") key.export(:output => file) # => the key will be written to the file.