Module: GPGME

Defined in:
lib/gpgme/compat.rb,
lib/gpgme.rb,
lib/gpgme/ctx.rb,
lib/gpgme/key.rb,
lib/gpgme/data.rb,
lib/gpgme/misc.rb,
lib/gpgme/error.rb,
lib/gpgme/crypto.rb,
lib/gpgme/engine.rb,
lib/gpgme/key_sig.rb,
lib/gpgme/sub_key.rb,
lib/gpgme/user_id.rb,
lib/gpgme/version.rb,
lib/gpgme/constants.rb,
lib/gpgme/signature.rb,
lib/gpgme/key_common.rb,
lib/gpgme/io_callbacks.rb,
ext/gpgme/gpgme_n.c

Overview

TODO: Find why is this needed. I guess the name compat means it’s just backwards compatibility. Consider removing?

Defined Under Namespace

Modules: Engine, KeyCommon Classes: Crypto, Ctx, Data, DecryptResult, EncryptResult, EngineInfo, Error, IOCallbacks, ImportResult, ImportStatus, InvalidKey, Key, KeySig, NewSignature, Recipient, SigNotation, SignResult, Signature, SubKey, TrustItem, UserID, VerifyResult

Constant Summary collapse

GpgmeError =
Error
GpgmeData =
Data
GpgmeEngineInfo =
EngineInfo
GpgmeCtx =
Ctx
GpgmeKey =
Key
GpgmeSubKey =
SubKey
GpgmeUserID =
UserID
GpgmeKeySig =
KeySig
GpgmeVerifyResult =
VerifyResult
GpgmeSignature =
Signature
GpgmeDecryptResult =
DecryptResult
GpgmeSignResult =
SignResult
GpgmeEncryptResult =
EncryptResult
GpgmeInvalidKey =
InvalidKey
GpgmeNewSignature =
NewSignature
GpgmeImportStatus =
ImportStatus
GpgmeImportResult =
ImportResult
VERSION =

The version of GPGME ruby binding you are using

"2.0.24"
ATTR_ALGO =
GPGME_ATTR_ALGO
ATTR_CAN_CERTIFY =
GPGME_ATTR_CAN_CERTIFY
ATTR_CAN_ENCRYPT =
GPGME_ATTR_CAN_ENCRYPT
ATTR_CAN_SIGN =
GPGME_ATTR_CAN_SIGN
ATTR_CHAINID =
GPGME_ATTR_CHAINID
ATTR_COMMENT =
GPGME_ATTR_COMMENT
ATTR_CREATED =
GPGME_ATTR_CREATED
ATTR_EMAIL =
GPGME_ATTR_EMAIL
ATTR_ERRTOK =
GPGME_ATTR_ERRTOK
ATTR_EXPIRE =
GPGME_ATTR_EXPIRE
ATTR_FPR =
GPGME_ATTR_FPR
ATTR_ISSUER =
GPGME_ATTR_ISSUER
ATTR_IS_SECRET =
GPGME_ATTR_IS_SECRET
ATTR_KEYID =
GPGME_ATTR_KEYID
ATTR_KEY_CAPS =
GPGME_ATTR_KEY_CAPS
ATTR_KEY_DISABLED =
GPGME_ATTR_KEY_DISABLED
ATTR_KEY_EXPIRED =
GPGME_ATTR_KEY_EXPIRED
ATTR_KEY_INVALID =
GPGME_ATTR_KEY_INVALID
ATTR_KEY_REVOKED =
GPGME_ATTR_KEY_REVOKED
ATTR_LEN =
GPGME_ATTR_LEN
ATTR_LEVEL =
GPGME_ATTR_LEVEL
ATTR_NAME =
GPGME_ATTR_NAME
ATTR_OTRUST =
GPGME_ATTR_OTRUST
ATTR_SERIAL =
GPGME_ATTR_SERIAL
ATTR_SIG_STATUS =
GPGME_ATTR_SIG_STATUS
ATTR_SIG_SUMMARY =
GPGME_ATTR_SIG_SUMMARY
ATTR_TYPE =
GPGME_ATTR_TYPE
ATTR_UID_INVALID =
GPGME_ATTR_UID_INVALID
ATTR_UID_REVOKED =
GPGME_ATTR_UID_REVOKED
ATTR_USERID =
GPGME_ATTR_USERID
ATTR_VALIDITY =
GPGME_ATTR_VALIDITY
DATA_ENCODING_ARMOR =
GPGME_DATA_ENCODING_ARMOR
DATA_ENCODING_BASE64 =
GPGME_DATA_ENCODING_BASE64
DATA_ENCODING_BINARY =
GPGME_DATA_ENCODING_BINARY
DATA_ENCODING_NONE =
GPGME_DATA_ENCODING_NONE
ENCRYPT_ALWAYS_TRUST =
GPGME_ENCRYPT_ALWAYS_TRUST
ENCRYPT_NO_ENCRYPT_TO =
GPGME_ENCRYPT_NO_ENCRYPT_TO
IMPORT_NEW =
GPGME_IMPORT_NEW
IMPORT_SECRET =
GPGME_IMPORT_SECRET
IMPORT_SIG =
GPGME_IMPORT_SIG
IMPORT_SUBKEY =
GPGME_IMPORT_SUBKEY
IMPORT_UID =
GPGME_IMPORT_UID
KEYLIST_MODE_EXTERN =
GPGME_KEYLIST_MODE_EXTERN
KEYLIST_MODE_LOCAL =
GPGME_KEYLIST_MODE_LOCAL
KEYLIST_MODE_SIGS =
GPGME_KEYLIST_MODE_SIGS
KEYLIST_MODE_VALIDATE =
GPGME_KEYLIST_MODE_VALIDATE
KEYLIST_MODE_SIG_NOTATIONS =
GPGME_KEYLIST_MODE_SIG_NOTATIONS
KEYLIST_MODE_EPHEMERAL =
GPGME_KEYLIST_MODE_EPHEMERAL
KEYLIST_MODE_WITH_SECRET =
GPGME_KEYLIST_MODE_WITH_SECRET
MD_CRC24_RFC2440 =
GPGME_MD_CRC24_RFC2440
MD_CRC32 =
GPGME_MD_CRC32
MD_CRC32_RFC1510 =
GPGME_MD_CRC32_RFC1510
MD_HAVAL =
GPGME_MD_HAVAL
MD_MD2 =
GPGME_MD_MD2
MD_MD4 =
GPGME_MD_MD4
MD_MD5 =
GPGME_MD_MD5
MD_RMD160 =
GPGME_MD_RMD160
MD_SHA1 =
GPGME_MD_SHA1
MD_SHA256 =
GPGME_MD_SHA256
MD_SHA224 =
GPGME_MD_SHA224
MD_SHA384 =
GPGME_MD_SHA384
MD_SHA512 =
GPGME_MD_SHA512
MD_TIGER =
GPGME_MD_TIGER
PINENTRY_MODE_DEFAULT =
GPGME_PINENTRY_MODE_DEFAULT
PINENTRY_MODE_ASK =
GPGME_PINENTRY_MODE_ASK
PINENTRY_MODE_CANCEL =
GPGME_PINENTRY_MODE_CANCEL
PINENTRY_MODE_ERROR =
GPGME_PINENTRY_MODE_ERROR
PINENTRY_MODE_LOOPBACK =
GPGME_PINENTRY_MODE_LOOPBACK
PINENTRY_MODE_NAMES =
{
  PINENTRY_MODE_DEFAULT  => :default,
  PINENTRY_MODE_ASK      => :ask,
  PINENTRY_MODE_CANCEL   => :cancel,
  PINENTRY_MODE_ERROR    => :error,
  PINENTRY_MODE_LOOPBACK => :loopback
}
PK_DSA =
GPGME_PK_DSA
PK_ELG =
GPGME_PK_ELG
PK_ELG_E =
GPGME_PK_ELG_E
PK_RSA =
GPGME_PK_RSA
PK_ECC =
GPGME_PK_ECC
PROTOCOL_CMS =
GPGME_PROTOCOL_CMS
PROTOCOL_OpenPGP =
GPGME_PROTOCOL_OpenPGP
SIGSUM_BAD_POLICY =
GPGME_SIGSUM_BAD_POLICY
SIGSUM_CRL_MISSING =
GPGME_SIGSUM_CRL_MISSING
SIGSUM_CRL_TOO_OLD =
GPGME_SIGSUM_CRL_TOO_OLD
SIGSUM_GREEN =
GPGME_SIGSUM_GREEN
SIGSUM_KEY_EXPIRED =
GPGME_SIGSUM_KEY_EXPIRED
SIGSUM_KEY_MISSING =
GPGME_SIGSUM_KEY_MISSING
SIGSUM_KEY_REVOKED =
GPGME_SIGSUM_KEY_REVOKED
SIGSUM_RED =
GPGME_SIGSUM_RED
SIGSUM_SIG_EXPIRED =
GPGME_SIGSUM_SIG_EXPIRED
SIGSUM_SYS_ERROR =
GPGME_SIGSUM_SYS_ERROR
SIGSUM_VALID =
GPGME_SIGSUM_VALID
SIG_MODE_CLEAR =
GPGME_SIG_MODE_CLEAR
SIG_MODE_DETACH =
GPGME_SIG_MODE_DETACH
SIG_MODE_NORMAL =
GPGME_SIG_MODE_NORMAL
SIG_STAT_BAD =
GPGME_SIG_STAT_BAD
SIG_STAT_DIFF =
GPGME_SIG_STAT_DIFF
SIG_STAT_ERROR =
GPGME_SIG_STAT_ERROR
SIG_STAT_GOOD =
GPGME_SIG_STAT_GOOD
SIG_STAT_GOOD_EXP =
GPGME_SIG_STAT_GOOD_EXP
SIG_STAT_GOOD_EXPKEY =
GPGME_SIG_STAT_GOOD_EXPKEY
SIG_STAT_NOKEY =
GPGME_SIG_STAT_NOKEY
SIG_STAT_NONE =
GPGME_SIG_STAT_NONE
SIG_STAT_NOSIG =
GPGME_SIG_STAT_NOSIG
STATUS_ABORT =
GPGME_STATUS_ABORT
STATUS_ALREADY_SIGNED =
GPGME_STATUS_ALREADY_SIGNED
STATUS_BADARMOR =
GPGME_STATUS_BADARMOR
STATUS_BADMDC =
GPGME_STATUS_BADMDC
STATUS_BADSIG =
GPGME_STATUS_BADSIG
STATUS_BAD_PASSPHRASE =
GPGME_STATUS_BAD_PASSPHRASE
STATUS_BEGIN_DECRYPTION =
GPGME_STATUS_BEGIN_DECRYPTION
STATUS_BEGIN_ENCRYPTION =
GPGME_STATUS_BEGIN_ENCRYPTION
STATUS_BEGIN_STREAM =
GPGME_STATUS_BEGIN_STREAM
STATUS_DECRYPTION_FAILED =
GPGME_STATUS_DECRYPTION_FAILED
STATUS_DECRYPTION_OKAY =
GPGME_STATUS_DECRYPTION_OKAY
STATUS_DELETE_PROBLEM =
GPGME_STATUS_DELETE_PROBLEM
STATUS_ENC_TO =
GPGME_STATUS_ENC_TO
STATUS_END_DECRYPTION =
GPGME_STATUS_END_DECRYPTION
STATUS_END_ENCRYPTION =
GPGME_STATUS_END_ENCRYPTION
STATUS_END_STREAM =
GPGME_STATUS_END_STREAM
STATUS_ENTER =
GPGME_STATUS_ENTER
STATUS_EOF =
GPGME_STATUS_EOF
STATUS_ERRMDC =
GPGME_STATUS_ERRMDC
STATUS_ERROR =
GPGME_STATUS_ERROR
STATUS_ERRSIG =
GPGME_STATUS_ERRSIG
STATUS_EXPKEYSIG =
GPGME_STATUS_EXPKEYSIG
STATUS_EXPSIG =
GPGME_STATUS_EXPSIG
STATUS_FILE_DONE =
GPGME_STATUS_FILE_DONE
STATUS_FILE_ERROR =
GPGME_STATUS_FILE_ERROR
STATUS_FILE_START =
GPGME_STATUS_FILE_START
STATUS_GET_BOOL =
GPGME_STATUS_GET_BOOL
STATUS_GET_HIDDEN =
GPGME_STATUS_GET_HIDDEN
STATUS_GET_LINE =
GPGME_STATUS_GET_LINE
STATUS_GOODMDC =
GPGME_STATUS_GOODMDC
STATUS_GOODSIG =
GPGME_STATUS_GOODSIG
STATUS_GOOD_PASSPHRASE =
GPGME_STATUS_GOOD_PASSPHRASE
STATUS_GOT_IT =
GPGME_STATUS_GOT_IT
STATUS_IMPORTED =
GPGME_STATUS_IMPORTED
STATUS_IMPORT_RES =
GPGME_STATUS_IMPORT_RES
STATUS_INV_RECP =
GPGME_STATUS_INV_RECP
STATUS_KEYEXPIRED =
GPGME_STATUS_KEYEXPIRED
STATUS_KEYREVOKED =
GPGME_STATUS_KEYREVOKED
STATUS_KEY_CREATED =
GPGME_STATUS_KEY_CREATED
STATUS_LEAVE =
GPGME_STATUS_LEAVE
STATUS_MISSING_PASSPHRASE =
GPGME_STATUS_MISSING_PASSPHRASE
STATUS_NEED_PASSPHRASE =
GPGME_STATUS_NEED_PASSPHRASE
STATUS_NEED_PASSPHRASE_SYM =
GPGME_STATUS_NEED_PASSPHRASE_SYM
STATUS_NODATA =
GPGME_STATUS_NODATA
STATUS_NOTATION_DATA =
GPGME_STATUS_NOTATION_DATA
STATUS_NOTATION_NAME =
GPGME_STATUS_NOTATION_NAME
STATUS_NO_PUBKEY =
GPGME_STATUS_NO_PUBKEY
STATUS_NO_RECP =
GPGME_STATUS_NO_RECP
STATUS_NO_SECKEY =
GPGME_STATUS_NO_SECKEY
STATUS_PKA_TRUST_BAD =
GPGME_STATUS_PKA_TRUST_BAD
STATUS_PKA_TRUST_GOOD =
GPGME_STATUS_PKA_TRUST_GOOD
STATUS_PLAINTEXT_LENGTH =
GPGME_STATUS_PLAINTEXT_LENGTH
STATUS_MOUNTPOINT =
GPGME_STATUS_MOUNTPOINT
STATUS_PINENTRY_LAUNCHED =
GPGME_STATUS_PINENTRY_LAUNCHED
STATUS_ATTRIBUTE =
GPGME_STATUS_ATTRIBUTE
STATUS_BEGIN_SIGNING =
GPGME_STATUS_BEGIN_SIGNING
STATUS_KEY_NOT_CREATED =
GPGME_STATUS_KEY_NOT_CREATED
STATUS_POLICY_URL =
GPGME_STATUS_POLICY_URL
STATUS_PROGRESS =
GPGME_STATUS_PROGRESS
STATUS_RSA_OR_IDEA =
GPGME_STATUS_RSA_OR_IDEA
STATUS_SESSION_KEY =
GPGME_STATUS_SESSION_KEY
STATUS_SHM_GET =
GPGME_STATUS_SHM_GET
STATUS_SHM_GET_BOOL =
GPGME_STATUS_SHM_GET_BOOL
STATUS_SHM_GET_HIDDEN =
GPGME_STATUS_SHM_GET_HIDDEN
STATUS_SHM_INFO =
GPGME_STATUS_SHM_INFO
STATUS_SIGEXPIRED =
GPGME_STATUS_SIGEXPIRED
STATUS_SIG_CREATED =
GPGME_STATUS_SIG_CREATED
STATUS_SIG_ID =
GPGME_STATUS_SIG_ID
STATUS_TRUNCATED =
GPGME_STATUS_TRUNCATED
STATUS_TRUST_FULLY =
GPGME_STATUS_TRUST_FULLY
STATUS_TRUST_MARGINAL =
GPGME_STATUS_TRUST_MARGINAL
STATUS_TRUST_NEVER =
GPGME_STATUS_TRUST_NEVER
STATUS_TRUST_ULTIMATE =
GPGME_STATUS_TRUST_ULTIMATE
STATUS_TRUST_UNDEFINED =
GPGME_STATUS_TRUST_UNDEFINED
STATUS_UNEXPECTED =
GPGME_STATUS_UNEXPECTED
STATUS_USERID_HINT =
GPGME_STATUS_USERID_HINT
STATUS_VALIDSIG =
GPGME_STATUS_VALIDSIG
VALIDITY_FULL =
GPGME_VALIDITY_FULL
VALIDITY_MARGINAL =
GPGME_VALIDITY_MARGINAL
VALIDITY_NEVER =
GPGME_VALIDITY_NEVER
VALIDITY_ULTIMATE =
GPGME_VALIDITY_ULTIMATE
VALIDITY_UNDEFINED =
GPGME_VALIDITY_UNDEFINED
VALIDITY_UNKNOWN =
GPGME_VALIDITY_UNKNOWN
PROTOCOL_NAMES =
{
  PROTOCOL_OpenPGP  => :OpenPGP,
  PROTOCOL_CMS      => :CMS
}
PROTOCOL_ASSUAN =
GPGME_PROTOCOL_ASSUAN
PROTOCOL_SPAWN =
GPGME_PROTOCOL_SPAWN
SPAWN_DETACHED =
GPGME_SPAWN_DETACHED
SPAWN_ALLOW_SET_FG =
GPGME_SPAWN_ALLOW_SET_FG
EXPORT_MODE_EXTERN =
GPGME_EXPORT_MODE_EXTERN
EXPORT_MODE_MINIMAL =
GPGME_EXPORT_MODE_MINIMAL
EXPORT_MODE_SECRET =
GPGME_EXPORT_MODE_SECRET
EXPORT_MODE_RAW =
GPGME_EXPORT_MODE_RAW
EXPORT_MODE_PKCS12 =
GPGME_EXPORT_MODE_PKCS12
KEYLIST_MODE_NAMES =
{
  KEYLIST_MODE_LOCAL    => :local,
  KEYLIST_MODE_EXTERN   => :extern,
  KEYLIST_MODE_SIGS     => :sigs,
  KEYLIST_MODE_VALIDATE => :validate
}
VALIDITY_NAMES =
{
  VALIDITY_UNKNOWN    => :unknown,
  VALIDITY_UNDEFINED  => :undefined,
  VALIDITY_NEVER      => :never,
  VALIDITY_MARGINAL   => :marginal,
  VALIDITY_FULL       => :full,
  VALIDITY_ULTIMATE   => :ultimate
}
GPGME_PK_RSA =

gpgme_pubkey_algo_t

INT2FIX(GPGME_PK_RSA)
GPGME_PK_DSA =
INT2FIX(GPGME_PK_DSA)
GPGME_PK_ELG =
INT2FIX(GPGME_PK_ELG)
GPGME_PK_ELG_E =
INT2FIX(GPGME_PK_ELG_E)
GPGME_PK_ECC =
INT2FIX(GPGME_PK_ECC)
GPGME_MD_MD5 =

gpgme_hash_algo_t

INT2FIX(GPGME_MD_MD5)
GPGME_MD_SHA1 =
INT2FIX(GPGME_MD_SHA1)
GPGME_MD_RMD160 =
INT2FIX(GPGME_MD_RMD160)
GPGME_MD_MD2 =
INT2FIX(GPGME_MD_MD2)
GPGME_MD_TIGER =
INT2FIX(GPGME_MD_TIGER)
GPGME_MD_HAVAL =
INT2FIX(GPGME_MD_HAVAL)
GPGME_MD_SHA224 =
INT2FIX(GPGME_MD_SHA224)
GPGME_MD_SHA256 =
INT2FIX(GPGME_MD_SHA256)
GPGME_MD_SHA384 =
INT2FIX(GPGME_MD_SHA384)
GPGME_MD_SHA512 =
INT2FIX(GPGME_MD_SHA512)
GPGME_MD_MD4 =
INT2FIX(GPGME_MD_MD4)
GPGME_MD_CRC32 =
INT2FIX(GPGME_MD_CRC32)
GPGME_MD_CRC32_RFC1510 =
INT2FIX(GPGME_MD_CRC32_RFC1510)
GPGME_MD_CRC24_RFC2440 =
INT2FIX(GPGME_MD_CRC24_RFC2440)
GPG_ERR_EOF =

gpgme_err_code_t

INT2FIX(GPG_ERR_EOF)
GPG_ERR_NO_ERROR =
INT2FIX(GPG_ERR_NO_ERROR)
GPG_ERR_GENERAL =
INT2FIX(GPG_ERR_GENERAL)
GPG_ERR_ENOMEM =
INT2FIX(GPG_ERR_ENOMEM)
GPG_ERR_INV_VALUE =
INT2FIX(GPG_ERR_INV_VALUE)
GPG_ERR_UNUSABLE_PUBKEY =
INT2FIX(GPG_ERR_UNUSABLE_PUBKEY)
GPG_ERR_UNUSABLE_SECKEY =
INT2FIX(GPG_ERR_UNUSABLE_SECKEY)
GPG_ERR_NO_DATA =
INT2FIX(GPG_ERR_NO_DATA)
GPG_ERR_CONFLICT =
INT2FIX(GPG_ERR_CONFLICT)
GPG_ERR_NOT_IMPLEMENTED =
INT2FIX(GPG_ERR_NOT_IMPLEMENTED)
GPG_ERR_DECRYPT_FAILED =
INT2FIX(GPG_ERR_DECRYPT_FAILED)
GPG_ERR_BAD_PASSPHRASE =
INT2FIX(GPG_ERR_BAD_PASSPHRASE)
GPG_ERR_KEY_EXPIRED =
INT2FIX(GPG_ERR_KEY_EXPIRED)
GPG_ERR_SIG_EXPIRED =
INT2FIX(GPG_ERR_SIG_EXPIRED)
GPG_ERR_CANCELED =
INT2FIX(GPG_ERR_CANCELED)
GPG_ERR_INV_ENGINE =
INT2FIX(GPG_ERR_INV_ENGINE)
GPG_ERR_AMBIGUOUS_NAME =
INT2FIX(GPG_ERR_AMBIGUOUS_NAME)
GPG_ERR_WRONG_KEY_USAGE =
INT2FIX(GPG_ERR_WRONG_KEY_USAGE)
GPG_ERR_CERT_REVOKED =
INT2FIX(GPG_ERR_CERT_REVOKED)
GPG_ERR_CERT_EXPIRED =
INT2FIX(GPG_ERR_CERT_EXPIRED)
GPG_ERR_NO_CRL_KNOWN =
INT2FIX(GPG_ERR_NO_CRL_KNOWN)
GPG_ERR_NO_POLICY_MATCH =
INT2FIX(GPG_ERR_NO_POLICY_MATCH)
GPG_ERR_NO_SECKEY =
INT2FIX(GPG_ERR_NO_SECKEY)
GPG_ERR_MISSING_CERT =
INT2FIX(GPG_ERR_MISSING_CERT)
GPG_ERR_BAD_CERT_CHAIN =
INT2FIX(GPG_ERR_BAD_CERT_CHAIN)
GPG_ERR_UNSUPPORTED_ALGORITHM =
INT2FIX(GPG_ERR_UNSUPPORTED_ALGORITHM)
GPG_ERR_BAD_SIGNATURE =
INT2FIX(GPG_ERR_BAD_SIGNATURE)
GPG_ERR_NO_PUBKEY =
INT2FIX(GPG_ERR_NO_PUBKEY)
GPG_ERR_SOURCE_UNKNOWN =

gpgme_err_source_t

INT2FIX(GPG_ERR_SOURCE_UNKNOWN)
GPG_ERR_SOURCE_GPGME =
INT2FIX(GPG_ERR_SOURCE_GPGME)
GPG_ERR_SOURCE_GPG =
INT2FIX(GPG_ERR_SOURCE_GPG)
GPG_ERR_SOURCE_GPGSM =
INT2FIX(GPG_ERR_SOURCE_GPGSM)
GPG_ERR_SOURCE_GCRYPT =
INT2FIX(GPG_ERR_SOURCE_GCRYPT)
GPG_ERR_SOURCE_GPGAGENT =
INT2FIX(GPG_ERR_SOURCE_GPGAGENT)
GPG_ERR_SOURCE_PINENTRY =
INT2FIX(GPG_ERR_SOURCE_PINENTRY)
GPG_ERR_SOURCE_SCD =
INT2FIX(GPG_ERR_SOURCE_SCD)
GPG_ERR_SOURCE_KEYBOX =
INT2FIX(GPG_ERR_SOURCE_KEYBOX)
GPG_ERR_SOURCE_USER_1 =
INT2FIX(GPG_ERR_SOURCE_USER_1)
GPG_ERR_SOURCE_USER_2 =
INT2FIX(GPG_ERR_SOURCE_USER_2)
GPG_ERR_SOURCE_USER_3 =
INT2FIX(GPG_ERR_SOURCE_USER_3)
GPG_ERR_SOURCE_USER_4 =
INT2FIX(GPG_ERR_SOURCE_USER_4)
GPGME_DATA_ENCODING_NONE =

gpgme_data_encoding_t

INT2FIX(GPGME_DATA_ENCODING_NONE)
GPGME_DATA_ENCODING_BINARY =
INT2FIX(GPGME_DATA_ENCODING_BINARY)
GPGME_DATA_ENCODING_BASE64 =
INT2FIX(GPGME_DATA_ENCODING_BASE64)
GPGME_DATA_ENCODING_ARMOR =
INT2FIX(GPGME_DATA_ENCODING_ARMOR)
GPGME_SIG_STAT_NONE =

gpgme_sig_stat_t

INT2FIX(GPGME_SIG_STAT_NONE)
GPGME_SIG_STAT_GOOD =
INT2FIX(GPGME_SIG_STAT_GOOD)
GPGME_SIG_STAT_BAD =
INT2FIX(GPGME_SIG_STAT_BAD)
GPGME_SIG_STAT_NOKEY =
INT2FIX(GPGME_SIG_STAT_NOKEY)
GPGME_SIG_STAT_NOSIG =
INT2FIX(GPGME_SIG_STAT_NOSIG)
GPGME_SIG_STAT_ERROR =
INT2FIX(GPGME_SIG_STAT_ERROR)
GPGME_SIG_STAT_DIFF =
INT2FIX(GPGME_SIG_STAT_DIFF)
GPGME_SIG_STAT_GOOD_EXP =
INT2FIX(GPGME_SIG_STAT_GOOD_EXP)
GPGME_SIG_STAT_GOOD_EXPKEY =
INT2FIX(GPGME_SIG_STAT_GOOD_EXPKEY)
GPGME_SIGSUM_VALID =

gpgme_sigsum_t

INT2FIX(GPGME_SIGSUM_VALID)
GPGME_SIGSUM_GREEN =
INT2FIX(GPGME_SIGSUM_GREEN)
GPGME_SIGSUM_RED =
INT2FIX(GPGME_SIGSUM_RED)
GPGME_SIGSUM_KEY_REVOKED =
INT2FIX(GPGME_SIGSUM_KEY_REVOKED)
GPGME_SIGSUM_KEY_EXPIRED =
INT2FIX(GPGME_SIGSUM_KEY_EXPIRED)
GPGME_SIGSUM_SIG_EXPIRED =
INT2FIX(GPGME_SIGSUM_SIG_EXPIRED)
GPGME_SIGSUM_KEY_MISSING =
INT2FIX(GPGME_SIGSUM_KEY_MISSING)
GPGME_SIGSUM_CRL_MISSING =
INT2FIX(GPGME_SIGSUM_CRL_MISSING)
GPGME_SIGSUM_CRL_TOO_OLD =
INT2FIX(GPGME_SIGSUM_CRL_TOO_OLD)
GPGME_SIGSUM_BAD_POLICY =
INT2FIX(GPGME_SIGSUM_BAD_POLICY)
GPGME_SIGSUM_SYS_ERROR =
INT2FIX(GPGME_SIGSUM_SYS_ERROR)
GPGME_SIG_MODE_NORMAL =

gpgme_sig_mode_t

INT2FIX(GPGME_SIG_MODE_NORMAL)
GPGME_SIG_MODE_DETACH =
INT2FIX(GPGME_SIG_MODE_DETACH)
GPGME_SIG_MODE_CLEAR =
INT2FIX(GPGME_SIG_MODE_CLEAR)
GPGME_ATTR_KEYID =

gpgme_attr_t

INT2FIX(GPGME_ATTR_KEYID)
GPGME_ATTR_FPR =
INT2FIX(GPGME_ATTR_FPR)
GPGME_ATTR_ALGO =
INT2FIX(GPGME_ATTR_ALGO)
GPGME_ATTR_LEN =
INT2FIX(GPGME_ATTR_LEN)
GPGME_ATTR_CREATED =
INT2FIX(GPGME_ATTR_CREATED)
GPGME_ATTR_EXPIRE =
INT2FIX(GPGME_ATTR_EXPIRE)
GPGME_ATTR_OTRUST =
INT2FIX(GPGME_ATTR_OTRUST)
GPGME_ATTR_USERID =
INT2FIX(GPGME_ATTR_USERID)
GPGME_ATTR_NAME =
INT2FIX(GPGME_ATTR_NAME)
GPGME_ATTR_EMAIL =
INT2FIX(GPGME_ATTR_EMAIL)
GPGME_ATTR_COMMENT =
INT2FIX(GPGME_ATTR_COMMENT)
GPGME_ATTR_VALIDITY =
INT2FIX(GPGME_ATTR_VALIDITY)
GPGME_ATTR_LEVEL =
INT2FIX(GPGME_ATTR_LEVEL)
GPGME_ATTR_TYPE =
INT2FIX(GPGME_ATTR_TYPE)
GPGME_ATTR_IS_SECRET =
INT2FIX(GPGME_ATTR_IS_SECRET)
GPGME_ATTR_KEY_REVOKED =
INT2FIX(GPGME_ATTR_KEY_REVOKED)
GPGME_ATTR_KEY_INVALID =
INT2FIX(GPGME_ATTR_KEY_INVALID)
GPGME_ATTR_UID_REVOKED =
INT2FIX(GPGME_ATTR_UID_REVOKED)
GPGME_ATTR_UID_INVALID =
INT2FIX(GPGME_ATTR_UID_INVALID)
GPGME_ATTR_KEY_CAPS =
INT2FIX(GPGME_ATTR_KEY_CAPS)
GPGME_ATTR_CAN_ENCRYPT =
INT2FIX(GPGME_ATTR_CAN_ENCRYPT)
GPGME_ATTR_CAN_SIGN =
INT2FIX(GPGME_ATTR_CAN_SIGN)
GPGME_ATTR_CAN_CERTIFY =
INT2FIX(GPGME_ATTR_CAN_CERTIFY)
GPGME_ATTR_KEY_EXPIRED =
INT2FIX(GPGME_ATTR_KEY_EXPIRED)
GPGME_ATTR_KEY_DISABLED =
INT2FIX(GPGME_ATTR_KEY_DISABLED)
GPGME_ATTR_SERIAL =
INT2FIX(GPGME_ATTR_SERIAL)
GPGME_ATTR_ISSUER =
INT2FIX(GPGME_ATTR_ISSUER)
GPGME_ATTR_CHAINID =
INT2FIX(GPGME_ATTR_CHAINID)
GPGME_ATTR_SIG_STATUS =
INT2FIX(GPGME_ATTR_SIG_STATUS)
GPGME_ATTR_ERRTOK =
INT2FIX(GPGME_ATTR_ERRTOK)
GPGME_ATTR_SIG_SUMMARY =
INT2FIX(GPGME_ATTR_SIG_SUMMARY)
GPGME_VALIDITY_UNKNOWN =

gpgme_validity_t

INT2FIX(GPGME_VALIDITY_UNKNOWN)
GPGME_VALIDITY_UNDEFINED =
INT2FIX(GPGME_VALIDITY_UNDEFINED)
GPGME_VALIDITY_NEVER =
INT2FIX(GPGME_VALIDITY_NEVER)
GPGME_VALIDITY_MARGINAL =
INT2FIX(GPGME_VALIDITY_MARGINAL)
GPGME_VALIDITY_FULL =
INT2FIX(GPGME_VALIDITY_FULL)
GPGME_VALIDITY_ULTIMATE =
INT2FIX(GPGME_VALIDITY_ULTIMATE)
GPGME_PROTOCOL_OpenPGP =

gpgme_protocol_t

INT2FIX(GPGME_PROTOCOL_OpenPGP)
GPGME_PROTOCOL_CMS =
INT2FIX(GPGME_PROTOCOL_CMS)
GPGME_PROTOCOL_ASSUAN =
INT2FIX(GPGME_PROTOCOL_ASSUAN))
#endif
  /* This protocol was added in 1.5.0. */
#ifdef GPGME_PROTOCOL_SPAWN
  rb_define_const (mGPGME, "GPGME_PROTOCOL_SPAWN",
INT2FIX(GPGME_PROTOCOL_SPAWN)
GPGME_STATUS_EOF =

gpgme_status_code_t

INT2FIX(GPGME_STATUS_EOF)
GPGME_STATUS_ENTER =

mkstatus starts here

INT2FIX(GPGME_STATUS_ENTER)
GPGME_STATUS_LEAVE =
INT2FIX(GPGME_STATUS_LEAVE)
GPGME_STATUS_ABORT =
INT2FIX(GPGME_STATUS_ABORT)
GPGME_STATUS_GOODSIG =
INT2FIX(GPGME_STATUS_GOODSIG)
GPGME_STATUS_BADSIG =
INT2FIX(GPGME_STATUS_BADSIG)
GPGME_STATUS_ERRSIG =
INT2FIX(GPGME_STATUS_ERRSIG)
GPGME_STATUS_BADARMOR =
INT2FIX(GPGME_STATUS_BADARMOR)
GPGME_STATUS_RSA_OR_IDEA =
INT2FIX(GPGME_STATUS_RSA_OR_IDEA)
GPGME_STATUS_KEYEXPIRED =
INT2FIX(GPGME_STATUS_KEYEXPIRED)
GPGME_STATUS_KEYREVOKED =
INT2FIX(GPGME_STATUS_KEYREVOKED)
GPGME_STATUS_TRUST_UNDEFINED =
INT2FIX(GPGME_STATUS_TRUST_UNDEFINED)
GPGME_STATUS_TRUST_NEVER =
INT2FIX(GPGME_STATUS_TRUST_NEVER)
GPGME_STATUS_TRUST_MARGINAL =
INT2FIX(GPGME_STATUS_TRUST_MARGINAL)
GPGME_STATUS_TRUST_FULLY =
INT2FIX(GPGME_STATUS_TRUST_FULLY)
GPGME_STATUS_TRUST_ULTIMATE =
INT2FIX(GPGME_STATUS_TRUST_ULTIMATE)
GPGME_STATUS_SHM_INFO =
INT2FIX(GPGME_STATUS_SHM_INFO)
GPGME_STATUS_SHM_GET =
INT2FIX(GPGME_STATUS_SHM_GET)
GPGME_STATUS_SHM_GET_BOOL =
INT2FIX(GPGME_STATUS_SHM_GET_BOOL)
GPGME_STATUS_SHM_GET_HIDDEN =
INT2FIX(GPGME_STATUS_SHM_GET_HIDDEN)
GPGME_STATUS_NEED_PASSPHRASE =
INT2FIX(GPGME_STATUS_NEED_PASSPHRASE)
GPGME_STATUS_VALIDSIG =
INT2FIX(GPGME_STATUS_VALIDSIG)
GPGME_STATUS_SIG_ID =
INT2FIX(GPGME_STATUS_SIG_ID)
GPGME_STATUS_ENC_TO =
INT2FIX(GPGME_STATUS_ENC_TO)
GPGME_STATUS_NODATA =
INT2FIX(GPGME_STATUS_NODATA)
GPGME_STATUS_BAD_PASSPHRASE =
INT2FIX(GPGME_STATUS_BAD_PASSPHRASE)
GPGME_STATUS_NO_PUBKEY =
INT2FIX(GPGME_STATUS_NO_PUBKEY)
GPGME_STATUS_NO_SECKEY =
INT2FIX(GPGME_STATUS_NO_SECKEY)
GPGME_STATUS_NEED_PASSPHRASE_SYM =
INT2FIX(GPGME_STATUS_NEED_PASSPHRASE_SYM)
GPGME_STATUS_DECRYPTION_FAILED =
INT2FIX(GPGME_STATUS_DECRYPTION_FAILED)
GPGME_STATUS_DECRYPTION_OKAY =
INT2FIX(GPGME_STATUS_DECRYPTION_OKAY)
GPGME_STATUS_MISSING_PASSPHRASE =
INT2FIX(GPGME_STATUS_MISSING_PASSPHRASE)
GPGME_STATUS_GOOD_PASSPHRASE =
INT2FIX(GPGME_STATUS_GOOD_PASSPHRASE)
GPGME_STATUS_GOODMDC =
INT2FIX(GPGME_STATUS_GOODMDC)
GPGME_STATUS_BADMDC =
INT2FIX(GPGME_STATUS_BADMDC)
GPGME_STATUS_ERRMDC =
INT2FIX(GPGME_STATUS_ERRMDC)
GPGME_STATUS_IMPORTED =
INT2FIX(GPGME_STATUS_IMPORTED)
GPGME_STATUS_IMPORT_RES =
INT2FIX(GPGME_STATUS_IMPORT_RES)
GPGME_STATUS_FILE_START =
INT2FIX(GPGME_STATUS_FILE_START)
GPGME_STATUS_FILE_DONE =
INT2FIX(GPGME_STATUS_FILE_DONE)
GPGME_STATUS_FILE_ERROR =
INT2FIX(GPGME_STATUS_FILE_ERROR)
GPGME_STATUS_BEGIN_DECRYPTION =
INT2FIX(GPGME_STATUS_BEGIN_DECRYPTION)
GPGME_STATUS_END_DECRYPTION =
INT2FIX(GPGME_STATUS_END_DECRYPTION)
GPGME_STATUS_BEGIN_ENCRYPTION =
INT2FIX(GPGME_STATUS_BEGIN_ENCRYPTION)
GPGME_STATUS_END_ENCRYPTION =
INT2FIX(GPGME_STATUS_END_ENCRYPTION)
GPGME_STATUS_DELETE_PROBLEM =
INT2FIX(GPGME_STATUS_DELETE_PROBLEM)
GPGME_STATUS_GET_BOOL =
INT2FIX(GPGME_STATUS_GET_BOOL)
GPGME_STATUS_GET_LINE =
INT2FIX(GPGME_STATUS_GET_LINE)
GPGME_STATUS_GET_HIDDEN =
INT2FIX(GPGME_STATUS_GET_HIDDEN)
GPGME_STATUS_GOT_IT =
INT2FIX(GPGME_STATUS_GOT_IT)
GPGME_STATUS_PROGRESS =
INT2FIX(GPGME_STATUS_PROGRESS)
GPGME_STATUS_SIG_CREATED =
INT2FIX(GPGME_STATUS_SIG_CREATED)
GPGME_STATUS_SESSION_KEY =
INT2FIX(GPGME_STATUS_SESSION_KEY)
GPGME_STATUS_NOTATION_NAME =
INT2FIX(GPGME_STATUS_NOTATION_NAME)
GPGME_STATUS_NOTATION_DATA =
INT2FIX(GPGME_STATUS_NOTATION_DATA)
GPGME_STATUS_POLICY_URL =
INT2FIX(GPGME_STATUS_POLICY_URL)
GPGME_STATUS_BEGIN_STREAM =
INT2FIX(GPGME_STATUS_BEGIN_STREAM)
GPGME_STATUS_END_STREAM =
INT2FIX(GPGME_STATUS_END_STREAM)
GPGME_STATUS_KEY_CREATED =
INT2FIX(GPGME_STATUS_KEY_CREATED)
GPGME_STATUS_USERID_HINT =
INT2FIX(GPGME_STATUS_USERID_HINT)
GPGME_STATUS_UNEXPECTED =
INT2FIX(GPGME_STATUS_UNEXPECTED)
GPGME_STATUS_INV_RECP =
INT2FIX(GPGME_STATUS_INV_RECP)
GPGME_STATUS_NO_RECP =
INT2FIX(GPGME_STATUS_NO_RECP)
GPGME_STATUS_ALREADY_SIGNED =
INT2FIX(GPGME_STATUS_ALREADY_SIGNED)
GPGME_STATUS_SIGEXPIRED =
INT2FIX(GPGME_STATUS_SIGEXPIRED)
GPGME_STATUS_EXPSIG =
INT2FIX(GPGME_STATUS_EXPSIG)
GPGME_STATUS_EXPKEYSIG =
INT2FIX(GPGME_STATUS_EXPKEYSIG)
GPGME_STATUS_TRUNCATED =
INT2FIX(GPGME_STATUS_TRUNCATED)
GPGME_STATUS_ERROR =
INT2FIX(GPGME_STATUS_ERROR)
GPGME_STATUS_PKA_TRUST_BAD =
INT2FIX(GPGME_STATUS_PKA_TRUST_BAD)
GPGME_STATUS_PKA_TRUST_GOOD =
INT2FIX(GPGME_STATUS_PKA_TRUST_GOOD)
GPGME_STATUS_PLAINTEXT_LENGTH =
INT2FIX(GPGME_STATUS_PLAINTEXT_LENGTH)
GPGME_STATUS_MOUNTPOINT =
INT2FIX(GPGME_STATUS_MOUNTPOINT)
GPGME_STATUS_PINENTRY_LAUNCHED =
INT2FIX(GPGME_STATUS_PINENTRY_LAUNCHED)
GPGME_STATUS_ATTRIBUTE =
INT2FIX(GPGME_STATUS_ATTRIBUTE)
GPGME_STATUS_BEGIN_SIGNING =
INT2FIX(GPGME_STATUS_BEGIN_SIGNING)
GPGME_STATUS_KEY_NOT_CREATED =
INT2FIX(GPGME_STATUS_KEY_NOT_CREATED)
GPGME_KEYLIST_MODE_LOCAL =

The available keylist mode flags.

INT2FIX(GPGME_KEYLIST_MODE_LOCAL)
GPGME_KEYLIST_MODE_EXTERN =
INT2FIX(GPGME_KEYLIST_MODE_EXTERN)
GPGME_KEYLIST_MODE_SIGS =
INT2FIX(GPGME_KEYLIST_MODE_SIGS)
GPGME_KEYLIST_MODE_SIG_NOTATIONS =
INT2FIX(GPGME_KEYLIST_MODE_SIG_NOTATIONS)
GPGME_KEYLIST_MODE_VALIDATE =
INT2FIX(GPGME_KEYLIST_MODE_VALIDATE)
GPGME_KEYLIST_MODE_EPHEMERAL =
INT2FIX(GPGME_KEYLIST_MODE_EPHEMERAL)
GPGME_KEYLIST_MODE_WITH_SECRET =
INT2FIX(GPGME_KEYLIST_MODE_WITH_SECRET)
GPGME_IMPORT_NEW =

The available flags for status field of gpgme_import_status_t.

INT2FIX(GPGME_IMPORT_NEW)
GPGME_IMPORT_UID =
INT2FIX(GPGME_IMPORT_UID)
GPGME_IMPORT_SIG =
INT2FIX(GPGME_IMPORT_SIG)
GPGME_IMPORT_SUBKEY =
INT2FIX(GPGME_IMPORT_SUBKEY)
GPGME_IMPORT_SECRET =
INT2FIX(GPGME_IMPORT_SECRET)
GPGME_ENCRYPT_ALWAYS_TRUST =

The available flags for gpgme_op_encrypt.

INT2FIX(GPGME_ENCRYPT_ALWAYS_TRUST)
GPGME_ENCRYPT_NO_ENCRYPT_TO =
INT2FIX(GPGME_ENCRYPT_NO_ENCRYPT_TO)
GPGME_PINENTRY_MODE_DEFAULT =
INT2FIX(GPGME_PINENTRY_MODE_DEFAULT)
GPGME_PINENTRY_MODE_ASK =
INT2FIX(GPGME_PINENTRY_MODE_ASK)
GPGME_PINENTRY_MODE_CANCEL =
INT2FIX(GPGME_PINENTRY_MODE_CANCEL)
GPGME_PINENTRY_MODE_ERROR =
INT2FIX(GPGME_PINENTRY_MODE_ERROR)
GPGME_PINENTRY_MODE_LOOPBACK =
INT2FIX(GPGME_PINENTRY_MODE_LOOPBACK)
GPGME_SPAWN_DETACHED =
INT2FIX(GPGME_SPAWN_DETACHED)
GPGME_SPAWN_ALLOW_SET_FG =
INT2FIX(GPGME_SPAWN_ALLOW_SET_FG)
GPGME_EXPORT_MODE_EXTERN =
INT2FIX(GPGME_EXPORT_MODE_EXTERN)
GPGME_EXPORT_MODE_MINIMAL =
INT2FIX(GPGME_EXPORT_MODE_MINIMAL)
GPGME_EXPORT_MODE_SECRET =
INT2FIX(GPGME_EXPORT_MODE_SECRET)
GPGME_EXPORT_MODE_RAW =
INT2FIX(GPGME_EXPORT_MODE_RAW)
GPGME_EXPORT_MODE_PKCS12 =
INT2FIX(GPGME_EXPORT_MODE_PKCS12)

Class Method Summary collapse

Class Method Details

.check_version(options = nil) ⇒ Object

TODO find out what it does, can’t seem to find a proper parameter that returns something other than nil.



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/gpgme.rb', line 93

def check_version(options = nil)
  version = nil
  if options.kind_of?(String)
    version = options
  elsif options.include?(:version)
    version = options[:version]
  end
  unless GPGME::gpgme_check_version(version)
    raise Error::InvalidVersion.new
  end
end

.error_to_exception(err) ⇒ Object

Auxiliary method used by all the library to generate exceptions from error codes returned by the C extension.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/gpgme.rb', line 31

def error_to_exception(err)
  case GPGME::gpgme_err_code(err)
  when GPG_ERR_EOF
    EOFError.new
  when GPG_ERR_NO_ERROR
    nil
  when GPG_ERR_GENERAL
    Error::General.new(err)
  when GPG_ERR_ENOMEM
    Errno::ENOMEM.new
  when GPG_ERR_INV_VALUE
    Error::InvalidValue.new(err)
  when GPG_ERR_UNUSABLE_PUBKEY
    Error::UnusablePublicKey.new(err)
  when GPG_ERR_UNUSABLE_SECKEY
    Error::UnusableSecretKey.new(err)
  when GPG_ERR_NO_DATA
    Error::NoData.new(err)
  when GPG_ERR_CONFLICT
    Error::Conflict.new(err)
  when GPG_ERR_NOT_IMPLEMENTED
    Error::NotImplemented.new(err)
  when GPG_ERR_DECRYPT_FAILED
    Error::DecryptFailed.new(err)
  when GPG_ERR_BAD_PASSPHRASE
    Error::BadPassphrase.new(err)
  when GPG_ERR_CANCELED
    Error::Canceled.new(err)
  when GPG_ERR_INV_ENGINE
    Error::InvalidEngine.new(err)
  when GPG_ERR_AMBIGUOUS_NAME
    Error::AmbiguousName.new(err)
  when GPG_ERR_WRONG_KEY_USAGE
    Error::WrongKeyUsage.new(err)
  when GPG_ERR_CERT_REVOKED
    Error::CertificateRevoked.new(err)
  when GPG_ERR_CERT_EXPIRED
    Error::CertificateExpired.new(err)
  when GPG_ERR_NO_CRL_KNOWN
    Error::NoCRLKnown.new(err)
  when GPG_ERR_NO_POLICY_MATCH
    Error::NoPolicyMatch.new(err)
  when GPG_ERR_NO_SECKEY
    Error::NoSecretKey.new(err)
  when GPG_ERR_MISSING_CERT
    Error::MissingCertificate.new(err)
  when GPG_ERR_BAD_CERT_CHAIN
    Error::BadCertificateChain.new(err)
  when GPG_ERR_UNSUPPORTED_ALGORITHM
    Error::UnsupportedAlgorithm.new(err)
  when GPG_ERR_BAD_SIGNATURE
    Error::BadSignature.new(err)
  when GPG_ERR_NO_PUBKEY
    Error::NoPublicKey.new(err)
  else
    Error.new(err)
  end
end

.gpgme_check_versionObject



144
145
146
147
148
149
150
# File 'ext/gpgme/gpgme_n.c', line 144

static VALUE
rb_s_gpgme_check_version (VALUE dummy, VALUE vreq)
{
  const char *result = gpgme_check_version (NIL_P(vreq) ? NULL :
                                            StringValueCStr(vreq));
  return result ? rb_str_new2 (result) : Qnil;
}

.gpgme_ctx_get_engine_infoObject



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'ext/gpgme/gpgme_n.c', line 199

static VALUE
rb_s_gpgme_ctx_get_engine_info (VALUE dummy, VALUE vctx, VALUE rinfo)
{
  long idx;

  gpgme_ctx_t ctx;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  gpgme_engine_info_t info = gpgme_ctx_get_engine_info (ctx);
      for (idx = 0; info; info = info->next, idx++)
        {
          VALUE vinfo = rb_class_new_instance (0, NULL, cEngineInfo);
          rb_iv_set (vinfo, "@protocol", INT2FIX(info->protocol));
          if (info->file_name)
            rb_iv_set (vinfo, "@file_name", rb_str_new2 (info->file_name));
          if (info->version)
            rb_iv_set (vinfo, "@version", rb_str_new2 (info->version));
          if (info->req_version)
            rb_iv_set (vinfo, "@req_version", rb_str_new2 (info->req_version));
          if (info->home_dir)
            rb_iv_set (vinfo, "@home_dir", rb_str_new2 (info->home_dir));
          rb_ary_store (rinfo, idx, vinfo);
        }
  return Qnil;
}

.gpgme_ctx_set_engine_infoObject



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'ext/gpgme/gpgme_n.c', line 228

static VALUE
rb_s_gpgme_ctx_set_engine_info (VALUE dummy, VALUE vctx, VALUE vproto, VALUE vfile_name,
                            VALUE vhome_dir)
{
  gpgme_ctx_t ctx;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  gpgme_error_t err = gpgme_ctx_set_engine_info (ctx,
               NUM2INT(vproto),
                                             NIL_P(vfile_name) ? NULL :
                                             StringValueCStr(vfile_name),
                                             NIL_P(vhome_dir) ? NULL :
                                             StringValueCStr(vhome_dir));
  return LONG2NUM(err);
}

.gpgme_data_get_encodingObject



449
450
451
452
453
454
455
456
457
458
# File 'ext/gpgme/gpgme_n.c', line 449

static VALUE
rb_s_gpgme_data_get_encoding (VALUE dummy, VALUE vdh)
{
  gpgme_data_t dh;
  gpgme_error_t err;

  UNWRAP_GPGME_DATA(vdh, dh);
  err = gpgme_data_get_encoding (dh);
  return LONG2NUM(err);
}

.gpgme_data_get_file_nameObject



471
472
473
474
475
476
477
478
479
# File 'ext/gpgme/gpgme_n.c', line 471

static VALUE
rb_s_gpgme_data_get_file_name (VALUE dummy, VALUE vdh)
{
  gpgme_data_t dh;

  UNWRAP_GPGME_DATA(vdh, dh);
  const char *result = gpgme_data_get_file_name (dh);
  return result ? rb_str_new2 (result) : Qnil;
}

.gpgme_data_newObject

Creating Data Buffers

gpgme_data_new_from_filepart is not currently supported.



282
283
284
285
286
287
288
289
290
291
# File 'ext/gpgme/gpgme_n.c', line 282

static VALUE
rb_s_gpgme_data_new (VALUE dummy, VALUE rdh)
{
  gpgme_data_t dh;
  gpgme_error_t err = gpgme_data_new (&dh);

  if (gpgme_err_code(err) == GPG_ERR_NO_ERROR)
    rb_ary_store (rdh, 0, WRAP_GPGME_DATA(dh));
  return LONG2NUM(err);
}

.gpgme_data_new_from_cbsObject



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'ext/gpgme/gpgme_n.c', line 381

static VALUE
rb_s_gpgme_data_new_from_cbs (VALUE dummy, VALUE rdh, VALUE vcbs,
                              VALUE vhandle)
{
  gpgme_data_t dh;
  gpgme_error_t err;
  VALUE vcbs_handle = rb_ary_new ();

  rb_ary_push (vcbs_handle, vcbs);
  rb_ary_push (vcbs_handle, vhandle);

  err = gpgme_data_new_from_cbs (&dh, &cbs, (void*)vcbs_handle);
  if (gpgme_err_code(err) == GPG_ERR_NO_ERROR)
    {
      VALUE vdh = WRAP_GPGME_DATA(dh);
      /* Keep a reference to avoid GC. */
      rb_iv_set (vdh, "@cbs_handle", vcbs_handle);
      rb_ary_store (rdh, 0, vdh);
    }
  return LONG2NUM(err);
}

.gpgme_data_new_from_fdObject



314
315
316
317
318
319
320
321
322
# File 'ext/gpgme/gpgme_n.c', line 314

static VALUE
rb_s_gpgme_data_new_from_fd (VALUE dummy, VALUE rdh, VALUE vfd)
{
  gpgme_data_t dh;
  gpgme_error_t err = gpgme_data_new_from_fd (&dh, NUM2INT(vfd));
  if (gpgme_err_code(err) == GPG_ERR_NO_ERROR)
    rb_ary_store (rdh, 0, WRAP_GPGME_DATA(dh));
  return LONG2NUM(err);
}

.gpgme_data_new_from_memObject



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'ext/gpgme/gpgme_n.c', line 293

static VALUE
rb_s_gpgme_data_new_from_mem (VALUE dummy, VALUE rdh, VALUE vbuffer,
                              VALUE vsize)
{
  gpgme_data_t dh;
  VALUE vdh;
  size_t size = NUM2UINT(vsize);
  gpgme_error_t err;

  if (RSTRING_LEN(vbuffer) < size)
    rb_raise (rb_eArgError, "argument out of range");

  err = gpgme_data_new_from_mem (&dh, StringValuePtr(vbuffer), size, 1);
  if (gpgme_err_code(err) == GPG_ERR_NO_ERROR)
    {
      vdh = WRAP_GPGME_DATA(dh);
      rb_ary_store (rdh, 0, vdh);
    }
  return LONG2NUM(err);
}

.gpgme_data_readObject

Manipulating Data Buffers



403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'ext/gpgme/gpgme_n.c', line 403

static VALUE
rb_s_gpgme_data_read (VALUE dummy, VALUE vdh, VALUE vlength)
{
  gpgme_data_t dh;
  ssize_t length = NUM2LONG(vlength), nread;
  void *buffer;
  VALUE vbuffer = Qnil;

  UNWRAP_GPGME_DATA(vdh, dh);

  buffer = ALLOC_N (char, length);
  nread = gpgme_data_read (dh, buffer, length);
  if (nread > 0)
    vbuffer = rb_str_new (buffer, nread);
  xfree (buffer);
  if (nread < 0)
    rb_sys_fail ("rb_s_gpgme_data_read");
  return vbuffer;
}

.gpgme_data_rewind(dh) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/gpgme/compat.rb', line 31

def gpgme_data_rewind(dh)
  begin
    GPGME::gpgme_data_seek(dh, 0, IO::SEEK_SET)
  rescue SystemCallError => e
    return e.errno
  end
end

.gpgme_data_seekObject



423
424
425
426
427
428
429
430
431
432
433
434
# File 'ext/gpgme/gpgme_n.c', line 423

static VALUE
rb_s_gpgme_data_seek (VALUE dummy, VALUE vdh, VALUE voffset, VALUE vwhence)
{
  gpgme_data_t dh;
  off_t pos;

  UNWRAP_GPGME_DATA(vdh, dh);
  pos = gpgme_data_seek (dh, NUM2LONG(voffset), NUM2INT(vwhence));
  if (pos < 0)
    rb_sys_fail ("rb_s_gpgme_data_seek");
  return LONG2NUM(pos);
}

.gpgme_data_set_encodingObject



460
461
462
463
464
465
466
467
468
469
# File 'ext/gpgme/gpgme_n.c', line 460

static VALUE
rb_s_gpgme_data_set_encoding (VALUE dummy, VALUE vdh, VALUE venc)
{
  gpgme_data_t dh;
  gpgme_error_t err;

  UNWRAP_GPGME_DATA(vdh, dh);
  err = gpgme_data_set_encoding (dh, NUM2INT(venc));
  return LONG2NUM(err);
}

.gpgme_data_set_file_nameObject



481
482
483
484
485
486
487
488
489
490
491
# File 'ext/gpgme/gpgme_n.c', line 481

static VALUE
rb_s_gpgme_data_set_file_name (VALUE dummy, VALUE vdh, VALUE vfile_name)
{
  gpgme_data_t dh;
  gpgme_error_t err;

  UNWRAP_GPGME_DATA(vdh, dh);
  err = gpgme_data_set_file_name (dh,
      NIL_P(vfile_name) ? NULL : StringValueCStr(vfile_name));
  return LONG2NUM(err);
}

.gpgme_data_writeObject



436
437
438
439
440
441
442
443
444
445
446
447
# File 'ext/gpgme/gpgme_n.c', line 436

static VALUE
rb_s_gpgme_data_write (VALUE dummy, VALUE vdh, VALUE vbuf, VALUE vlen)
{
  gpgme_data_t dh;
  ssize_t nwrite;

  UNWRAP_GPGME_DATA(vdh, dh);
  nwrite = gpgme_data_write (dh, StringValuePtr(vbuf), NUM2UINT(vlen));
  if (nwrite < 0)
    rb_sys_fail ("rb_s_gpgme_data_write");
  return LONG2NUM(nwrite);
}

.gpgme_engine_check_versionObject



152
153
154
155
156
157
# File 'ext/gpgme/gpgme_n.c', line 152

static VALUE
rb_s_gpgme_engine_check_version (VALUE dummy, VALUE vproto)
{
  gpgme_error_t err = gpgme_engine_check_version (NUM2INT(vproto));
  return LONG2NUM(err);
}

.gpgme_err_codeObject



264
265
266
267
268
# File 'ext/gpgme/gpgme_n.c', line 264

static VALUE
rb_s_gpgme_err_code (VALUE dummy, VALUE verr)
{
  return INT2FIX(gpgme_err_code (NUM2LONG(verr)));
}

.gpgme_err_sourceObject



270
271
272
273
274
# File 'ext/gpgme/gpgme_n.c', line 270

static VALUE
rb_s_gpgme_err_source (VALUE dummy, VALUE verr)
{
  return INT2FIX(gpgme_err_source (NUM2LONG(verr)));
}

.gpgme_get_armorObject



596
597
598
599
600
601
602
603
604
605
606
607
# File 'ext/gpgme/gpgme_n.c', line 596

static VALUE
rb_s_gpgme_get_armor (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  int yes;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  yes = gpgme_get_armor (ctx);
  return INT2FIX(yes);
}

.gpgme_get_ctx_flagObject



536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'ext/gpgme/gpgme_n.c', line 536

static VALUE
rb_s_gpgme_get_ctx_flag (VALUE dummy, VALUE vctx, VALUE vname)
{
  gpgme_ctx_t ctx;
  const char* name;
  int yes;

  name = StringValueCStr(vname);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  const char* result;
  result = gpgme_get_ctx_flag(ctx, name);
  if (result == NULL)
    rb_raise (rb_eArgError, "incorrect ctx flag name");

  return rb_str_new_cstr(result);
}

.gpgme_get_dirinfoObject



136
137
138
139
140
141
# File 'ext/gpgme/gpgme_n.c', line 136

static VALUE
rb_s_gpgme_get_dirinfo (VALUE dummy, VALUE vwhat)
{
  const char *result = gpgme_get_dirinfo (StringValueCStr(vwhat));
  return result ? rb_str_new2 (result) : Qnil;
}

.gpgme_get_engine_infoObject



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'ext/gpgme/gpgme_n.c', line 159

static VALUE
rb_s_gpgme_get_engine_info (VALUE dummy, VALUE rinfo)
{
  gpgme_engine_info_t info;
  gpgme_error_t err;
  long idx;

  err = gpgme_get_engine_info (&info);
  if (gpgme_err_code(err) == GPG_ERR_NO_ERROR)
    {
      for (idx = 0; info; info = info->next, idx++)
        {
          VALUE vinfo = rb_class_new_instance (0, NULL, cEngineInfo);
          rb_iv_set (vinfo, "@protocol", INT2FIX(info->protocol));
          if (info->file_name)
            rb_iv_set (vinfo, "@file_name", rb_str_new2 (info->file_name));
          if (info->version)
            rb_iv_set (vinfo, "@version", rb_str_new2 (info->version));
          if (info->req_version)
            rb_iv_set (vinfo, "@req_version", rb_str_new2 (info->req_version));
          if (info->home_dir)
            rb_iv_set (vinfo, "@home_dir", rb_str_new2 (info->home_dir));
          rb_ary_store (rinfo, idx, vinfo);
        }
    }
  return LONG2NUM(err);
}

.gpgme_get_ignore_mdc_errorObject



626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
# File 'ext/gpgme/gpgme_n.c', line 626

static VALUE
rb_s_gpgme_get_ignore_mdc_error (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  int yes;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  const char* result;
  result = gpgme_get_ctx_flag(ctx, "ignore-mdc-error");
  if (result == NULL)
    rb_raise (rb_eArgError, "incorrect ctx flag name");

  yes = (result && *result)? !!atoi (result) : 0;
  return INT2FIX(yes);
}

.gpgme_get_include_certsObject



682
683
684
685
686
687
688
689
690
691
692
693
# File 'ext/gpgme/gpgme_n.c', line 682

static VALUE
rb_s_gpgme_get_include_certs (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  err = gpgme_get_include_certs (ctx);
  return LONG2NUM(err);
}

.gpgme_get_keyObject



1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
# File 'ext/gpgme/gpgme_n.c', line 1132

static VALUE
rb_s_gpgme_get_key (VALUE dummy, VALUE vctx, VALUE vfpr, VALUE rkey,
                    VALUE vsecret)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;
  gpgme_key_t key;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  err = gpgme_get_key (ctx, StringValueCStr(vfpr), &key, NUM2INT(vsecret));

  if (gpgme_err_code(err) == GPG_ERR_NO_ERROR)
    {
      VALUE vkey = WRAP_GPGME_KEY(key);
      save_gpgme_key_attrs (vkey, key);
      rb_ary_store (rkey, 0, vkey);
    }
  return LONG2NUM(err);
}

.gpgme_get_keylist_modeObject



708
709
710
711
712
713
714
715
716
717
718
719
# File 'ext/gpgme/gpgme_n.c', line 708

static VALUE
rb_s_gpgme_get_keylist_mode (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  int mode;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  mode = gpgme_get_keylist_mode (ctx);
  return INT2FIX(mode);
}

.gpgme_get_offlineObject



919
920
921
922
923
924
925
926
927
928
929
930
931
# File 'ext/gpgme/gpgme_n.c', line 919

static VALUE
rb_s_gpgme_get_offline (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  int yes;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  yes = gpgme_get_offline (ctx);
  return yes ? Qtrue : Qfalse;
}

.gpgme_get_passphrase_cbObject



758
759
760
761
762
763
764
765
766
767
768
# File 'ext/gpgme/gpgme_n.c', line 758

static VALUE
rb_s_gpgme_get_passphrase_cb (VALUE dummy, VALUE vctx, VALUE rpassfunc,
                              VALUE rhook_value)
{
  VALUE vcb = rb_iv_get (vctx, "@passphrase_cb");

  /* No need to call gpgme_get_passphrase_cb. */
  rb_ary_store (rpassfunc, 0, RARRAY_PTR(vcb)[0]);
  rb_ary_store (rhook_value, 0, RARRAY_PTR(vcb)[1]);
  return Qnil;
}

.gpgme_get_pinentry_modeObject



890
891
892
893
894
895
896
897
898
899
900
901
902
# File 'ext/gpgme/gpgme_n.c', line 890

static VALUE
rb_s_gpgme_get_pinentry_mode (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_pinentry_mode_t mode;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  mode = gpgme_get_pinentry_mode (ctx);
  return INT2FIX(mode);
}

.gpgme_get_progress_cbObject



851
852
853
854
855
856
857
858
859
# File 'ext/gpgme/gpgme_n.c', line 851

static VALUE
rb_s_gpgme_get_progress_cb (VALUE dummy, VALUE vctx, VALUE rprogfunc,
                            VALUE rhook_value)
{
  VALUE vcb = rb_iv_get (vctx, "@progress_cb");
  rb_ary_store (rprogfunc, 0, RARRAY_PTR(vcb)[0]);
  rb_ary_store (rhook_value, 0, RARRAY_PTR(vcb)[1]);
  return Qnil;
}

.gpgme_get_protocolObject



570
571
572
573
574
575
576
577
578
579
580
581
# File 'ext/gpgme/gpgme_n.c', line 570

static VALUE
rb_s_gpgme_get_protocol (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_protocol_t proto;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  proto = gpgme_get_protocol (ctx);
  return INT2FIX(proto);
}

.gpgme_get_status_cbObject



805
806
807
808
809
810
811
812
813
814
815
# File 'ext/gpgme/gpgme_n.c', line 805

static VALUE
rb_s_gpgme_get_status_cb (VALUE dummy, VALUE vctx, VALUE rstatusfunc,
                          VALUE rhook_value)
{
  VALUE vcb = rb_iv_get (vctx, "@status_cb");

  /* No need to call gpgme_get_status_cb. */
  rb_ary_store (rstatusfunc, 0, RARRAY_PTR(vcb)[0]);
  rb_ary_store (rhook_value, 0, RARRAY_PTR(vcb)[1]);
  return Qnil;
}

.gpgme_get_textmodeObject



657
658
659
660
661
662
663
664
665
666
667
668
# File 'ext/gpgme/gpgme_n.c', line 657

static VALUE
rb_s_gpgme_get_textmode (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  int yes;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  yes = gpgme_get_textmode (ctx);
  return INT2FIX(yes);
}

.gpgme_hash_algo_nameObject Also known as: hash_algo_name



255
256
257
258
259
260
261
262
# File 'ext/gpgme/gpgme_n.c', line 255

static VALUE
rb_s_gpgme_hash_algo_name (VALUE dummy, VALUE valgo)
{
  const char *name = gpgme_hash_algo_name (NUM2INT(valgo));
  if (name)
    return rb_str_new2 (name);
  return Qnil;
}

.gpgme_newObject

Creating Contexts



493
494
495
496
497
498
499
500
501
502
# File 'ext/gpgme/gpgme_n.c', line 493

static VALUE
rb_s_gpgme_new (VALUE dummy, VALUE rctx)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err = gpgme_new (&ctx);

  if (gpgme_err_code(err) == GPG_ERR_NO_ERROR)
    rb_ary_store (rctx, 0, WRAP_GPGME_CTX(ctx));
  return LONG2NUM(err);
}

.gpgme_op_card_editObject



1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
# File 'ext/gpgme/gpgme_n.c', line 1578

static VALUE
rb_s_gpgme_op_card_edit (VALUE dummy, VALUE vctx, VALUE vkey,
                    VALUE veditfunc, VALUE vhook_value, VALUE vout)
{
  gpgme_ctx_t ctx;
  gpgme_key_t key;
  gpgme_data_t out = NULL;
  VALUE vcb;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_KEY(vkey, key);
  if (!NIL_P(vout))
    UNWRAP_GPGME_DATA(vout, out);

  vcb = rb_ary_new ();
  rb_ary_push (vcb, veditfunc);
  rb_ary_push (vcb, vhook_value);
  /* Keep a reference to avoid GC. */
  rb_iv_set (vctx, "@card_edit_cb", vcb);

  err = gpgme_op_card_edit (ctx, key, edit_cb, (void *)vcb, out);
  return LONG2NUM(err);
}

.gpgme_op_card_edit_startObject



1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
# File 'ext/gpgme/gpgme_n.c', line 1607

static VALUE
rb_s_gpgme_op_card_edit_start (VALUE dummy, VALUE vctx, VALUE vkey,
                               VALUE veditfunc, VALUE vhook_value, VALUE vout)
{
  gpgme_ctx_t ctx;
  gpgme_key_t key;
  gpgme_data_t out = NULL;
  VALUE vcb;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_KEY(vkey, key);
  if (!NIL_P(vout))
    UNWRAP_GPGME_DATA(vout, out);

  vcb = rb_ary_new ();
  rb_ary_push (vcb, veditfunc);
  rb_ary_push (vcb, vhook_value);
  /* Keep a reference to avoid GC. */
  rb_iv_set (vctx, "@card_edit_cb", vcb);

  err = gpgme_op_card_edit_start (ctx, key, edit_cb, (void *)vcb, out);
  return LONG2NUM(err);
}

.gpgme_op_decryptObject

Decrypt



1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
# File 'ext/gpgme/gpgme_n.c', line 1700

static VALUE
rb_s_gpgme_op_decrypt (VALUE dummy, VALUE vctx, VALUE vcipher, VALUE vplain)
{
  gpgme_ctx_t ctx;
  gpgme_data_t cipher, plain;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vcipher, cipher);
  UNWRAP_GPGME_DATA(vplain, plain);

  err = gpgme_op_decrypt (ctx, cipher, plain);
  return LONG2NUM(err);
}

.gpgme_op_decrypt_resultObject



1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
# File 'ext/gpgme/gpgme_n.c', line 1739

static VALUE
rb_s_gpgme_op_decrypt_result (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_decrypt_result_t result;
  gpgme_recipient_t recipient;
  VALUE vresult, vrecipients;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  result = gpgme_op_decrypt_result (ctx);
  if (!result)
    rb_raise (rb_eArgError, "no result");

  vresult = rb_class_new_instance (0, NULL, cDecryptResult);
  if (result->unsupported_algorithm)
    rb_iv_set (vresult, "@unsupported_algorithm",
               rb_str_new2 (result->unsupported_algorithm));
  rb_iv_set (vresult, "@wrong_key_usage", INT2FIX(result->wrong_key_usage));
  vrecipients = rb_ary_new ();
  rb_iv_set (vresult, "@recipients", vrecipients);
  for (recipient = result->recipients; recipient; recipient = recipient->next)
    {
      VALUE vrecipient = rb_class_new_instance (0, NULL, cRecipient);
      rb_iv_set (vrecipient, "@pubkey_algo", INT2FIX(recipient->pubkey_algo));
      rb_iv_set (vrecipient, "@keyid", rb_str_new2 (recipient->keyid));
      rb_iv_set (vrecipient, "@status", UINT2NUM(recipient->status));
      rb_ary_push (vrecipients, vrecipient);
    }
  if (result->file_name)
    rb_iv_set (vresult, "@file_name", rb_str_new2 (result->file_name));
  return vresult;
}

.gpgme_op_decrypt_startObject



1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
# File 'ext/gpgme/gpgme_n.c', line 1719

static VALUE
rb_s_gpgme_op_decrypt_start (VALUE dummy, VALUE vctx, VALUE vcipher,
                             VALUE vplain)
{
  gpgme_ctx_t ctx;
  gpgme_data_t cipher, plain;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vcipher, cipher);
  UNWRAP_GPGME_DATA(vplain, plain);

  err = gpgme_op_decrypt_start (ctx, cipher, plain);
  return LONG2NUM(err);
}

.gpgme_op_decrypt_verifyObject

Decrypt and Verify



1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
# File 'ext/gpgme/gpgme_n.c', line 1882

static VALUE
rb_s_gpgme_op_decrypt_verify (VALUE dummy, VALUE vctx, VALUE vcipher,
                              VALUE vplain)
{
  gpgme_ctx_t ctx;
  gpgme_data_t cipher, plain;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vcipher, cipher);
  UNWRAP_GPGME_DATA(vplain, plain);

  err = gpgme_op_decrypt_verify (ctx, cipher, plain);
  return LONG2NUM(err);
}

.gpgme_op_decrypt_verify_startObject



1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
# File 'ext/gpgme/gpgme_n.c', line 1902

static VALUE
rb_s_gpgme_op_decrypt_verify_start (VALUE dummy, VALUE vctx, VALUE vcipher,
                                    VALUE vplain)
{
  gpgme_ctx_t ctx;
  gpgme_data_t cipher, plain;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vcipher, cipher);
  UNWRAP_GPGME_DATA(vplain, plain);

  err = gpgme_op_decrypt_verify_start (ctx, cipher, plain);
  return LONG2NUM(err);
}

.gpgme_op_deleteObject



1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
# File 'ext/gpgme/gpgme_n.c', line 1469

static VALUE
rb_s_gpgme_op_delete (VALUE dummy, VALUE vctx, VALUE vkey, VALUE vallow_secret)
{
  gpgme_ctx_t ctx;
  gpgme_key_t key;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_KEY(vkey, key);

  err = gpgme_op_delete (ctx, key, NUM2INT(vallow_secret));
  return LONG2NUM(err);
}

.gpgme_op_delete_startObject



1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
# File 'ext/gpgme/gpgme_n.c', line 1487

static VALUE
rb_s_gpgme_op_delete_start (VALUE dummy, VALUE vctx, VALUE vkey,
                            VALUE vallow_secret)
{
  gpgme_ctx_t ctx;
  gpgme_key_t key;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_KEY(vkey, key);

  err = gpgme_op_delete_start (ctx, key, NUM2INT(vallow_secret));
  return LONG2NUM(err);
}

.gpgme_op_editObject



1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
# File 'ext/gpgme/gpgme_n.c', line 1520

static VALUE
rb_s_gpgme_op_edit (VALUE dummy, VALUE vctx, VALUE vkey,
                    VALUE veditfunc, VALUE vhook_value, VALUE vout)
{
  gpgme_ctx_t ctx;
  gpgme_key_t key;
  gpgme_data_t out = NULL;
  VALUE vcb;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_KEY(vkey, key);
  if (!NIL_P(vout))
    UNWRAP_GPGME_DATA(vout, out);

  vcb = rb_ary_new ();
  rb_ary_push (vcb, veditfunc);
  rb_ary_push (vcb, vhook_value);
  /* Keep a reference to avoid GC. */
  rb_iv_set (vctx, "@edit_cb", vcb);

  err = gpgme_op_edit (ctx, key, edit_cb, (void *)vcb, out);
  return LONG2NUM(err);
}

.gpgme_op_edit_startObject



1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
# File 'ext/gpgme/gpgme_n.c', line 1549

static VALUE
rb_s_gpgme_op_edit_start (VALUE dummy, VALUE vctx, VALUE vkey,
                          VALUE veditfunc, VALUE vhook_value, VALUE vout)
{
  gpgme_ctx_t ctx;
  gpgme_key_t key;
  gpgme_data_t out = NULL;
  VALUE vcb;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_KEY(vkey, key);
  if (!NIL_P(vout))
    UNWRAP_GPGME_DATA(vout, out);

  vcb = rb_ary_new ();
  rb_ary_push (vcb, veditfunc);
  rb_ary_push (vcb, vhook_value);
  /* Keep a reference to avoid GC. */
  rb_iv_set (vctx, "@edit_cb", vcb);

  err = gpgme_op_edit_start (ctx, key, edit_cb, (void *)vcb, out);
  return LONG2NUM(err);
}

.gpgme_op_encryptObject

Encrypt



2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
# File 'ext/gpgme/gpgme_n.c', line 2057

static VALUE
rb_s_gpgme_op_encrypt (VALUE dummy, VALUE vctx, VALUE vrecp, VALUE vflags,
                       VALUE vplain, VALUE vcipher)
{
  gpgme_ctx_t ctx;
  gpgme_key_t *recp = NULL;
  gpgme_data_t plain, cipher;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  /* If RECP is `NULL', symmetric rather than public key encryption is
     performed. */
  if (!NIL_P(vrecp))
    {
      int i;
      recp = ALLOC_N(gpgme_key_t, RARRAY_LEN(vrecp) + 1);
      for (i = 0; i < RARRAY_LEN(vrecp); i++)
        UNWRAP_GPGME_KEY(RARRAY_PTR(vrecp)[i], recp[i]);
      recp[i] = NULL;
    }
  UNWRAP_GPGME_DATA(vplain, plain);
  UNWRAP_GPGME_DATA(vcipher, cipher);

  err = gpgme_op_encrypt (ctx, recp, NUM2INT(vflags), plain, cipher);
  if (recp)
    xfree (recp);
  return LONG2NUM(err);
}

.gpgme_op_encrypt_resultObject



2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
# File 'ext/gpgme/gpgme_n.c', line 2123

static VALUE
rb_s_gpgme_op_encrypt_result (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_encrypt_result_t result;
  gpgme_invalid_key_t invalid_key;
  VALUE vresult, vinvalid_recipients;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  result = gpgme_op_encrypt_result (ctx);
  if (!result)
    rb_raise (rb_eArgError, "no result");

  vresult = rb_class_new_instance (0, NULL, cEncryptResult);
  vinvalid_recipients = rb_ary_new ();
  rb_iv_set (vresult, "@invalid_recipients", vinvalid_recipients);
  for (invalid_key = result->invalid_recipients; invalid_key;
       invalid_key = invalid_key->next)
    {
      VALUE vinvalid_key =
        rb_class_new_instance (0, NULL, cInvalidKey);
      rb_iv_set (vinvalid_key, "@fpr", rb_str_new2 (invalid_key->fpr));
      rb_iv_set (vinvalid_key, "@reason", LONG2NUM(invalid_key->reason));
      rb_ary_push (vinvalid_recipients, vinvalid_key);
    }
  return vresult;
}

.gpgme_op_encrypt_signObject



2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
# File 'ext/gpgme/gpgme_n.c', line 2156

static VALUE
rb_s_gpgme_op_encrypt_sign (VALUE dummy, VALUE vctx, VALUE vrecp, VALUE vflags,
                            VALUE vplain, VALUE vcipher)
{
  gpgme_ctx_t ctx;
  gpgme_key_t *recp = NULL;
  gpgme_data_t plain, cipher;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  /* If RECP is `NULL', symmetric rather than public key encryption is
     performed. */
  if (!NIL_P(vrecp))
    {
      int i;
      recp = ALLOC_N(gpgme_key_t, RARRAY_LEN(vrecp) + 1);
      for (i = 0; i < RARRAY_LEN(vrecp); i++)
        UNWRAP_GPGME_KEY(RARRAY_PTR(vrecp)[i], recp[i]);
      recp[i] = NULL;
    }
  UNWRAP_GPGME_DATA(vplain, plain);
  UNWRAP_GPGME_DATA(vcipher, cipher);

  err = gpgme_op_encrypt_sign (ctx, recp, NUM2INT(vflags), plain, cipher);
  if (recp)
    xfree (recp);
  return LONG2NUM(err);
}

.gpgme_op_encrypt_sign_startObject



2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
# File 'ext/gpgme/gpgme_n.c', line 2189

static VALUE
rb_s_gpgme_op_encrypt_sign_start (VALUE dummy, VALUE vctx, VALUE vrecp,
                                  VALUE vflags, VALUE vplain, VALUE vcipher)
{
  gpgme_ctx_t ctx;
  gpgme_key_t *recp = NULL;
  gpgme_data_t plain, cipher;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  /* If RECP is `NULL', symmetric rather than public key encryption is
     performed. */
  if (!NIL_P(vrecp))
    {
      int i;
      recp = ALLOC_N(gpgme_key_t, RARRAY_LEN(vrecp) + 1);
      for (i = 0; i < RARRAY_LEN(vrecp); i++)
        UNWRAP_GPGME_KEY(RARRAY_PTR(vrecp)[i], recp[i]);
      recp[i] = NULL;
    }
  UNWRAP_GPGME_DATA(vplain, plain);
  UNWRAP_GPGME_DATA(vcipher, cipher);

  err = gpgme_op_encrypt_sign_start (ctx, recp, NUM2INT(vflags), plain,
                                     cipher);
  if (recp)
    xfree (recp);
  return LONG2NUM(err);
}

.gpgme_op_encrypt_startObject



2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
# File 'ext/gpgme/gpgme_n.c', line 2090

static VALUE
rb_s_gpgme_op_encrypt_start (VALUE dummy, VALUE vctx, VALUE vrecp,
                             VALUE vflags, VALUE vplain, VALUE vcipher)
{
  gpgme_ctx_t ctx;
  gpgme_key_t *recp = NULL;
  gpgme_data_t plain, cipher;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  /* If RECP is `NULL', symmetric rather than public key encryption is
     performed. */
  if (!NIL_P(vrecp))
    {
      int i;
      recp = ALLOC_N(gpgme_key_t, RARRAY_LEN(vrecp) + 1);
      for (i = 0; i < RARRAY_LEN(vrecp); i++)
        UNWRAP_GPGME_KEY(RARRAY_PTR(vrecp)[i], recp[i]);
      recp[i] = NULL;
    }
  UNWRAP_GPGME_DATA(vplain, plain);
  UNWRAP_GPGME_DATA(vcipher, cipher);

  err = gpgme_op_encrypt_start (ctx, recp, NUM2INT(vflags), plain, cipher);
  if (recp)
    xfree (recp);
  return LONG2NUM(err);
}

.gpgme_op_exportObject



1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
# File 'ext/gpgme/gpgme_n.c', line 1198

static VALUE
rb_s_gpgme_op_export (VALUE dummy, VALUE vctx, VALUE vpattern, VALUE vmode,
                      VALUE vkeydata)
{
  gpgme_ctx_t ctx;
  gpgme_data_t keydata;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vkeydata, keydata);

  err = gpgme_op_export (ctx, StringValueCStr(vpattern), NUM2UINT(vmode),
                         keydata);
  return LONG2NUM(err);
}

.gpgme_op_export_extObject



1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
# File 'ext/gpgme/gpgme_n.c', line 1238

static VALUE
rb_s_gpgme_op_export_ext (VALUE dummy, VALUE vctx, VALUE vpattern, VALUE vmode,
                          VALUE vkeydata)
{
  gpgme_ctx_t ctx;
  gpgme_data_t keydata;
  gpgme_error_t err;
  const char **pattern;
  int i;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  pattern = ALLOC_N(const char *, RARRAY_LEN(vpattern));
  for (i = 0; i < RARRAY_LEN(vpattern); i++)
    pattern[i] = StringValueCStr(RARRAY_PTR(vpattern)[i]);
  UNWRAP_GPGME_DATA(vkeydata, keydata);

  err = gpgme_op_export_ext (ctx, pattern, NUM2UINT(vmode), keydata);
  return LONG2NUM(err);
}

.gpgme_op_export_ext_startObject



1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
# File 'ext/gpgme/gpgme_n.c', line 1262

static VALUE
rb_s_gpgme_op_export_ext_start (VALUE dummy, VALUE vctx, VALUE vpattern,
                            VALUE vmode, VALUE vkeydata)
{
  gpgme_ctx_t ctx;
  gpgme_data_t keydata;
  gpgme_error_t err;
  const char **pattern;
  int i;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  pattern = ALLOC_N(const char *, RARRAY_LEN(vpattern));
  for (i = 0; i < RARRAY_LEN(vpattern); i++)
    pattern[i] = StringValueCStr(RARRAY_PTR(vpattern)[i]);
  UNWRAP_GPGME_DATA(vkeydata, keydata);

  err = gpgme_op_export_ext_start (ctx, pattern, NUM2UINT(vmode), keydata);
  return LONG2NUM(err);
}

.gpgme_op_export_keysObject



1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
# File 'ext/gpgme/gpgme_n.c', line 1287

static VALUE
rb_s_gpgme_op_export_keys (VALUE dummy, VALUE vctx, VALUE vkeys,
                           VALUE vmode, VALUE vkeydata)
{
  gpgme_ctx_t ctx;
  gpgme_key_t *keys;
  gpgme_data_t keydata;
  gpgme_error_t err;
  int i;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  keys = ALLOC_N(gpgme_key_t, RARRAY_LEN(vkeys) + 1);
  for (i = 0; i < RARRAY_LEN(vkeys); i++)
    UNWRAP_GPGME_KEY(RARRAY_PTR(vkeys)[i], keys[i]);

  UNWRAP_GPGME_DATA(vkeydata, keydata);

  err = gpgme_op_export_keys (ctx, keys, NUM2UINT(vmode), keydata);
  return LONG2NUM(err);
}

.gpgme_op_export_keys_startObject



1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
# File 'ext/gpgme/gpgme_n.c', line 1313

static VALUE
rb_s_gpgme_op_export_keys_start (VALUE dummy, VALUE vctx, VALUE vkeys,
                                 VALUE vmode, VALUE vkeydata)
{
  gpgme_ctx_t ctx;
  gpgme_key_t *keys;
  gpgme_data_t keydata;
  gpgme_error_t err;
  int i;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  keys = ALLOC_N(gpgme_key_t, RARRAY_LEN(vkeys) + 1);
  for (i = 0; i < RARRAY_LEN(vkeys); i++)
    UNWRAP_GPGME_KEY(RARRAY_PTR(vkeys)[i], keys[i]);

  UNWRAP_GPGME_DATA(vkeydata, keydata);

  err = gpgme_op_export_keys_start (ctx, keys, NUM2UINT(vmode), keydata);
  return LONG2NUM(err);
}

.gpgme_op_export_startObject



1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
# File 'ext/gpgme/gpgme_n.c', line 1218

static VALUE
rb_s_gpgme_op_export_start (VALUE dummy, VALUE vctx, VALUE vpattern,
                            VALUE vmode, VALUE vkeydata)
{
  gpgme_ctx_t ctx;
  gpgme_data_t keydata;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vkeydata, keydata);

  err = gpgme_op_export_start (ctx, StringValueCStr(vpattern),
                               NUM2UINT(vmode), keydata);
  return LONG2NUM(err);
}

.gpgme_op_genkeyObject



1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
# File 'ext/gpgme/gpgme_n.c', line 1154

static VALUE
rb_s_gpgme_op_genkey (VALUE dummy, VALUE vctx, VALUE vparms, VALUE vpubkey,
                      VALUE vseckey)
{
  gpgme_ctx_t ctx;
  gpgme_data_t pubkey = NULL, seckey = NULL;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  if (!NIL_P(vpubkey))
    UNWRAP_GPGME_DATA(vpubkey, pubkey);
  if (!NIL_P(vseckey))
    UNWRAP_GPGME_DATA(vseckey, seckey);

  err = gpgme_op_genkey (ctx, StringValueCStr(vparms), pubkey, seckey);
  return LONG2NUM(err);
}

.gpgme_op_genkey_startObject



1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
# File 'ext/gpgme/gpgme_n.c', line 1176

static VALUE
rb_s_gpgme_op_genkey_start (VALUE dummy, VALUE vctx, VALUE vparms,
                            VALUE vpubkey, VALUE vseckey)
{
  gpgme_ctx_t ctx;
  gpgme_data_t pubkey = NULL, seckey = NULL;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  if (!NIL_P(vpubkey))
    UNWRAP_GPGME_DATA(vpubkey, pubkey);
  if (!NIL_P(vseckey))
    UNWRAP_GPGME_DATA(vseckey, seckey);

  err = gpgme_op_genkey_start (ctx, StringValueCStr(vparms), pubkey, seckey);
  return LONG2NUM(err);
}

.gpgme_op_importObject



1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
# File 'ext/gpgme/gpgme_n.c', line 1340

static VALUE
rb_s_gpgme_op_import (VALUE dummy, VALUE vctx, VALUE vkeydata)
{
  gpgme_ctx_t ctx;
  gpgme_data_t keydata;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vkeydata, keydata);

  err = gpgme_op_import (ctx, keydata);
  return LONG2NUM(err);
}

.gpgme_op_import_ext(ctx, keydata, nr) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/gpgme/compat.rb', line 40

def gpgme_op_import_ext(ctx, keydata, nr)
  err = GPGME::gpgme_op_import(ctx, keydata)
  if GPGME::gpgme_err_code(err) == GPGME::GPG_ERR_NO_ERROR
    result = GPGME::gpgme_op_import_result(ctx)
    nr.push(result.considered)
  end
end

.gpgme_op_import_keysObject



1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
# File 'ext/gpgme/gpgme_n.c', line 1377

static VALUE
rb_s_gpgme_op_import_keys (VALUE dummy, VALUE vctx, VALUE vkeys)
{
  gpgme_ctx_t ctx;
  gpgme_key_t *keys;
  gpgme_error_t err;
  int i;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  keys = ALLOC_N(gpgme_key_t, RARRAY_LEN(vkeys) + 1);
  for (i = 0; i < RARRAY_LEN(vkeys); i++)
    UNWRAP_GPGME_KEY(RARRAY_PTR(vkeys)[i], keys[i]);
  keys[i] = NULL;

  err = gpgme_op_import_keys (ctx, keys);
  return LONG2NUM(err);
}

.gpgme_op_import_keys_startObject



1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
# File 'ext/gpgme/gpgme_n.c', line 1400

static VALUE
rb_s_gpgme_op_import_keys_start (VALUE dummy, VALUE vctx, VALUE vkeys)
{
  gpgme_ctx_t ctx;
  gpgme_key_t *keys;
  gpgme_error_t err;
  int i;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  keys = ALLOC_N(gpgme_key_t, RARRAY_LEN(vkeys) + 1);
  for (i = 0; i < RARRAY_LEN(vkeys); i++)
    UNWRAP_GPGME_KEY(RARRAY_PTR(vkeys)[i], keys[i]);
  keys[i] = NULL;

  err = gpgme_op_import_keys_start (ctx, keys);
  return LONG2NUM(err);
}

.gpgme_op_import_resultObject



1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
# File 'ext/gpgme/gpgme_n.c', line 1424

static VALUE
rb_s_gpgme_op_import_result (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_import_result_t result;
  gpgme_import_status_t status;
  VALUE vresult, vimports;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  result = gpgme_op_import_result (ctx);
  if (!result)
    rb_raise (rb_eArgError, "no result");

  vresult = rb_class_new_instance (0, NULL, cImportResult);
  rb_iv_set (vresult, "@considered", INT2NUM(result->considered));
  rb_iv_set (vresult, "@no_user_id", INT2NUM(result->no_user_id));
  rb_iv_set (vresult, "@imported", INT2NUM(result->imported));
  rb_iv_set (vresult, "@imported_rsa", INT2NUM(result->imported_rsa));
  rb_iv_set (vresult, "@unchanged", INT2NUM(result->unchanged));
  rb_iv_set (vresult, "@new_user_ids", INT2NUM(result->new_user_ids));
  rb_iv_set (vresult, "@new_sub_keys", INT2NUM(result->new_sub_keys));
  rb_iv_set (vresult, "@new_signatures", INT2NUM(result->new_signatures));
  rb_iv_set (vresult, "@new_revocations", INT2NUM(result->new_revocations));
  rb_iv_set (vresult, "@secret_read", INT2NUM(result->secret_read));
  rb_iv_set (vresult, "@secret_imported", INT2NUM(result->secret_imported));
  rb_iv_set (vresult, "@secret_unchanged", INT2NUM(result->secret_unchanged));
  rb_iv_set (vresult, "@not_imported", INT2NUM(result->not_imported));
  vimports = rb_ary_new ();
  rb_iv_set (vresult, "@imports", vimports);
  for (status = result->imports; status;
       status = status->next)
    {
      VALUE vstatus =
        rb_class_new_instance (0, NULL, cImportStatus);
      rb_iv_set (vstatus, "@fpr", rb_str_new2 (status->fpr));
      rb_iv_set (vstatus, "@result", LONG2NUM(status->result));
      rb_iv_set (vstatus, "@status", UINT2NUM(status->status));
      rb_ary_push (vimports, vstatus);
    }
  return vresult;
}

.gpgme_op_import_startObject



1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
# File 'ext/gpgme/gpgme_n.c', line 1358

static VALUE
rb_s_gpgme_op_import_start (VALUE dummy, VALUE vctx, VALUE vkeydata)
{
  gpgme_ctx_t ctx;
  gpgme_data_t keydata;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vkeydata, keydata);

  err = gpgme_op_import_start (ctx, keydata);
  return LONG2NUM(err);
}

.gpgme_op_keylist_endObject



1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
# File 'ext/gpgme/gpgme_n.c', line 1115

static VALUE
rb_s_gpgme_op_keylist_end (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;

  CHECK_KEYLIST_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  err = gpgme_op_keylist_end (ctx);
  RESET_KEYLIST_IN_PROGRESS(vctx);
  return LONG2NUM(err);
}

.gpgme_op_keylist_ext_startObject



956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
# File 'ext/gpgme/gpgme_n.c', line 956

static VALUE
rb_s_gpgme_op_keylist_ext_start (VALUE dummy, VALUE vctx, VALUE vpattern,
                                 VALUE vsecret_only)
{
  gpgme_ctx_t ctx;
  const char **pattern = NULL;
  int i, err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  if (!NIL_P(vpattern))
    {
      /* Convert RARRAY into `const char *' array. */
      pattern = ALLOC_N(const char *, RARRAY_LEN(vpattern) + 1);
      for (i = 0; i<RARRAY_LEN(vpattern); i++)
        pattern[i] = StringValueCStr(RARRAY_PTR(vpattern)[i]);
      pattern[RARRAY_LEN(vpattern)] = NULL;
    }

  err = gpgme_op_keylist_ext_start (ctx, pattern, NUM2INT(vsecret_only), 0);
  if (gpgme_err_code (err) == GPG_ERR_NO_ERROR)
    SET_KEYLIST_IN_PROGRESS(vctx);
  if (pattern)
    xfree (pattern);
  return LONG2NUM(err);
}

.gpgme_op_keylist_nextObject



1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
# File 'ext/gpgme/gpgme_n.c', line 1092

static VALUE
rb_s_gpgme_op_keylist_next (VALUE dummy, VALUE vctx, VALUE rkey)
{
  gpgme_ctx_t ctx;
  gpgme_key_t key;
  gpgme_error_t err;

  CHECK_KEYLIST_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  err = gpgme_op_keylist_next (ctx, &key);
  if (gpgme_err_code(err) == GPG_ERR_NO_ERROR)
    {
      VALUE vkey = WRAP_GPGME_KEY(key);
      save_gpgme_key_attrs (vkey, key);
      rb_ary_store (rkey, 0, vkey);
    }
  return LONG2NUM(err);
}

.gpgme_op_keylist_startObject

Key Management



934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
# File 'ext/gpgme/gpgme_n.c', line 934

static VALUE
rb_s_gpgme_op_keylist_start (VALUE dummy, VALUE vctx, VALUE vpattern,
                             VALUE vsecret_only)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  err = gpgme_op_keylist_start (ctx, NIL_P(vpattern) ? NULL :
                                StringValueCStr(vpattern),
                                NUM2INT(vsecret_only));
  if (gpgme_err_code (err) == GPG_ERR_NO_ERROR)
    SET_KEYLIST_IN_PROGRESS(vctx);
  return LONG2NUM(err);
}

.gpgme_op_signObject



1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
# File 'ext/gpgme/gpgme_n.c', line 1966

static VALUE
rb_s_gpgme_op_sign (VALUE dummy, VALUE vctx, VALUE vplain, VALUE vsig,
                    VALUE vmode)
{
  gpgme_ctx_t ctx;
  gpgme_data_t plain, sig;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vplain, plain);
  UNWRAP_GPGME_DATA(vsig, sig);

  err = gpgme_op_sign (ctx, plain, sig, NUM2INT(vmode));
  return LONG2NUM(err);
}

.gpgme_op_sign_resultObject



2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
# File 'ext/gpgme/gpgme_n.c', line 2006

static VALUE
rb_s_gpgme_op_sign_result (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_sign_result_t result;
  gpgme_invalid_key_t invalid_key;
  gpgme_new_signature_t new_signature;
  VALUE vresult, vinvalid_signers, vsignatures;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  result = gpgme_op_sign_result (ctx);
  if (!result)
    rb_raise (rb_eArgError, "no result");

  vresult = rb_class_new_instance (0, NULL, cSignResult);
  vinvalid_signers = rb_ary_new ();
  rb_iv_set (vresult, "@invalid_signers", vinvalid_signers);
  for (invalid_key = result->invalid_signers; invalid_key;
       invalid_key = invalid_key->next)
    {
      VALUE vinvalid_key =
        rb_class_new_instance (0, NULL, cInvalidKey);
      rb_iv_set (vinvalid_key, "@fpr", rb_str_new2 (invalid_key->fpr));
      rb_iv_set (vinvalid_key, "@reason", LONG2NUM(invalid_key->reason));
      rb_ary_push (vinvalid_signers, vinvalid_key);
    }
  vsignatures = rb_ary_new ();
  rb_iv_set (vresult, "@signatures", vsignatures);
  for (new_signature = result->signatures; new_signature;
       new_signature = new_signature->next)
    {
      VALUE vnew_signature =
        rb_class_new_instance (0, NULL, cNewSignature);
      rb_iv_set (vnew_signature, "@type", INT2FIX(new_signature->type));
      rb_iv_set (vnew_signature, "@pubkey_algo",
                 INT2FIX(new_signature->pubkey_algo));
      rb_iv_set (vnew_signature, "@hash_algo",
                 INT2FIX(new_signature->hash_algo));
      rb_iv_set (vnew_signature, "@sig_class",
                 UINT2NUM(new_signature->sig_class));
      rb_iv_set (vnew_signature, "@timestamp",
                 LONG2NUM(new_signature->timestamp));
      rb_iv_set (vnew_signature, "@fpr", rb_str_new2 (new_signature->fpr));
      rb_ary_push (vsignatures, vnew_signature);
    }
  return vresult;
}

.gpgme_op_sign_startObject



1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
# File 'ext/gpgme/gpgme_n.c', line 1986

static VALUE
rb_s_gpgme_op_sign_start (VALUE dummy, VALUE vctx, VALUE vplain, VALUE vsig,
                          VALUE vmode)
{
  gpgme_ctx_t ctx;
  gpgme_data_t plain, sig;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vplain, plain);
  UNWRAP_GPGME_DATA(vsig, sig);

  err = gpgme_op_sign_start (ctx, plain, sig, NUM2INT(vmode));
  return LONG2NUM(err);
}

.gpgme_op_spawnObject



2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
# File 'ext/gpgme/gpgme_n.c', line 2294

static VALUE
rb_s_gpgme_op_spawn (VALUE dummy, VALUE vctx, VALUE vfile,
                     VALUE vargv, VALUE vdatain, VALUE vdataout,
                     VALUE vdataerr, VALUE vflags)
{
  gpgme_ctx_t ctx;
  const char *file;
  const char **argv;
  gpgme_data_t datain = NULL;
  gpgme_data_t dataout = NULL;
  gpgme_data_t dataerr = NULL;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  file = StringValueCStr(vfile);

  if (NIL_P(vargv))
    argv = NULL;
  else
    {
      int i;

      argv = ALLOC_N(const char *, RARRAY_LEN(vargv) + 1);
      for (i = 0; i < RARRAY_LEN(vargv); i++)
        argv[i] = StringValueCStr(RARRAY_PTR(vargv)[i]);
      argv[i] = NULL;
    }

  UNWRAP_GPGME_DATA(vdatain, datain);
  UNWRAP_GPGME_DATA(vdataout, dataout);
  UNWRAP_GPGME_DATA(vdataerr, dataerr);

  err = gpgme_op_spawn (ctx, file, argv, datain, dataout, dataerr,
                        NUM2INT(vflags));
  if (argv)
    xfree (argv);
  return LONG2NUM(err);
}

.gpgme_op_spawn_startObject



2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
# File 'ext/gpgme/gpgme_n.c', line 2250

static VALUE
rb_s_gpgme_op_spawn_start (VALUE dummy, VALUE vctx, VALUE vfile,
                           VALUE vargv, VALUE vdatain, VALUE vdataout,
                           VALUE vdataerr, VALUE vflags)
{
  gpgme_ctx_t ctx;
  const char *file;
  const char **argv;
  gpgme_data_t datain = NULL;
  gpgme_data_t dataout = NULL;
  gpgme_data_t dataerr = NULL;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  file = StringValueCStr(vfile);

  if (NIL_P(vargv))
    argv = NULL;
  else
    {
      int i;

      argv = ALLOC_N(const char *, RARRAY_LEN(vargv) + 1);
      for (i = 0; i < RARRAY_LEN(vargv); i++)
        argv[i] = StringValueCStr(RARRAY_PTR(vargv)[i]);
      argv[i] = NULL;
    }

  UNWRAP_GPGME_DATA(vdatain, datain);
  UNWRAP_GPGME_DATA(vdataout, dataout);
  UNWRAP_GPGME_DATA(vdataerr, dataerr);

  err = gpgme_op_spawn_start (ctx, file, argv, datain, dataout, dataerr,
                              NUM2INT(vflags));
  if (argv)
    xfree (argv);
  return LONG2NUM(err);
}

.gpgme_op_trustlist_endObject



1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
# File 'ext/gpgme/gpgme_n.c', line 1684

static VALUE
rb_s_gpgme_op_trustlist_end (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  err = gpgme_op_trustlist_end (ctx);
  return LONG2NUM(err);
}

.gpgme_op_trustlist_nextObject



1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
# File 'ext/gpgme/gpgme_n.c', line 1653

static VALUE
rb_s_gpgme_op_trustlist_next (VALUE dummy, VALUE vctx, VALUE ritem)
{
  gpgme_ctx_t ctx;
  gpgme_trust_item_t item;
  gpgme_error_t err;
  VALUE vitem;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  err = gpgme_op_trustlist_next (ctx, &item);
  if (gpgme_err_code(err) == GPG_ERR_NO_ERROR)
    {
      vitem = WRAP_GPGME_TRUST_ITEM(item);
      rb_iv_set (vitem, "@keyid", rb_str_new2 (item->keyid));
      rb_iv_set (vitem, "@type", INT2FIX(item->type));
      rb_iv_set (vitem, "@level", INT2FIX(item->level));
      if (item->owner_trust)
        rb_iv_set (vitem, "@owner_trust", rb_str_new2 (item->owner_trust));
      rb_iv_set (vitem, "@validity", rb_str_new2 (item->validity));
      if (item->name)
        rb_iv_set (vitem, "@name", rb_str_new2 (item->name));
      rb_ary_store (ritem, 0, vitem);
    }
  return LONG2NUM(err);
}

.gpgme_op_trustlist_startObject

Trust Item Management



1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
# File 'ext/gpgme/gpgme_n.c', line 1636

static VALUE
rb_s_gpgme_op_trustlist_start (VALUE dummy, VALUE vctx, VALUE vpattern,
                               VALUE vmax_level)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  err = gpgme_op_trustlist_start (ctx, StringValueCStr(vpattern),
                                  NUM2INT(vmax_level));
  return LONG2NUM(err);
}

.gpgme_op_verifyObject

Verify



1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
# File 'ext/gpgme/gpgme_n.c', line 1775

static VALUE
rb_s_gpgme_op_verify (VALUE dummy, VALUE vctx, VALUE vsig, VALUE vsigned_text,
                      VALUE vplain)
{
  gpgme_ctx_t ctx;
  gpgme_data_t sig, signed_text = NULL, plain = NULL;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vsig, sig);
  if (!NIL_P(vsigned_text))
    UNWRAP_GPGME_DATA(vsigned_text, signed_text);
  if (!NIL_P(vplain))
    UNWRAP_GPGME_DATA(vplain, plain);

  err = gpgme_op_verify (ctx, sig, signed_text, plain);
  return LONG2NUM(err);
}

.gpgme_op_verify_resultObject



1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
# File 'ext/gpgme/gpgme_n.c', line 1821

static VALUE
rb_s_gpgme_op_verify_result (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;
  gpgme_verify_result_t verify_result;
  gpgme_signature_t signature;
  VALUE vverify_result, vsignatures = rb_ary_new ();

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  verify_result = gpgme_op_verify_result (ctx);
  if (!verify_result)
    rb_raise (rb_eArgError, "no result");

  vverify_result = rb_class_new_instance(0, NULL, cVerifyResult);
  rb_iv_set (vverify_result, "@signatures", vsignatures);
  for (signature = verify_result->signatures; signature;
       signature = signature->next)
    {
      VALUE vsignature = rb_class_new_instance(0, NULL, cSignature),
        vnotations = rb_ary_new ();
      gpgme_sig_notation_t notation;
      rb_iv_set (vsignature, "@summary", INT2FIX(signature->summary));
      rb_iv_set (vsignature, "@fpr", rb_str_new2 (signature->fpr));
      rb_iv_set (vsignature, "@status", LONG2NUM(signature->status));
      rb_iv_set (vsignature, "@notations", vnotations);
      for (notation = signature->notations; notation;
           notation = notation->next)
        {
          VALUE vnotation = rb_class_new_instance(0, NULL, cSigNotation);
          /* The docs say:
           * The name of the notation field. If this is NULL, then the member
           * value will contain a policy URL. */
          if (notation->name == NULL)
            rb_iv_set (vnotation, "@name", Qnil);
          else
            rb_iv_set (vnotation, "@name", rb_str_new2 (notation->name));
          rb_iv_set (vnotation, "@value", rb_str_new2 (notation->value));
          rb_ary_push (vnotations, vnotation);
        }
      rb_iv_set (vsignature, "@timestamp", ULONG2NUM(signature->timestamp));
      rb_iv_set (vsignature, "@exp_timestamp",
                 ULONG2NUM(signature->exp_timestamp));
      rb_iv_set (vsignature, "@wrong_key_usage",
                 INT2FIX(signature->wrong_key_usage));
      rb_iv_set (vsignature, "@validity", INT2FIX(signature->validity));
      rb_iv_set (vsignature, "@validity_reason",
                 LONG2NUM(signature->validity_reason));
      /* PKA related fields were added in 1.1.1. */
#ifdef GPGME_STATUS_PKA_TRUST_BAD
      rb_iv_set (vsignature, "@pka_trust", INT2FIX(signature->pka_trust));
      rb_iv_set (vsignature, "@pka_address",
                 rb_str_new2 (signature->pka_address));
#endif
      rb_ary_push (vsignatures, vsignature);
    }
  return vverify_result;
}

.gpgme_op_verify_startObject



1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
# File 'ext/gpgme/gpgme_n.c', line 1798

static VALUE
rb_s_gpgme_op_verify_start (VALUE dummy, VALUE vctx, VALUE vsig,
                            VALUE vsigned_text, VALUE vplain)
{
  gpgme_ctx_t ctx;
  gpgme_data_t sig, signed_text = NULL, plain = NULL;
  gpgme_error_t err;

  CHECK_KEYLIST_NOT_IN_PROGRESS(vctx);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_DATA(vsig, sig);
  if (!NIL_P(vsigned_text))
    UNWRAP_GPGME_DATA(vsigned_text, signed_text);
  if (!NIL_P(vplain))
    UNWRAP_GPGME_DATA(vplain, plain);

  err = gpgme_op_verify_start (ctx, sig, signed_text, plain);
  return LONG2NUM(err);
}

.gpgme_pubkey_algo_nameObject Also known as: pubkey_algo_name



246
247
248
249
250
251
252
253
# File 'ext/gpgme/gpgme_n.c', line 246

static VALUE
rb_s_gpgme_pubkey_algo_name (VALUE dummy, VALUE valgo)
{
  const char *name = gpgme_pubkey_algo_name (NUM2INT(valgo));
  if (name)
    return rb_str_new2 (name);
  return Qnil;
}

.gpgme_releaseObject



504
505
506
507
508
509
510
511
512
513
514
515
# File 'ext/gpgme/gpgme_n.c', line 504

static VALUE
rb_s_gpgme_release (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  gpgme_release (ctx);
  DATA_PTR(vctx) = NULL;
  return Qnil;
}

.gpgme_set_armorObject



583
584
585
586
587
588
589
590
591
592
593
594
# File 'ext/gpgme/gpgme_n.c', line 583

static VALUE
rb_s_gpgme_set_armor (VALUE dummy, VALUE vctx, VALUE vyes)
{
  gpgme_ctx_t ctx;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  gpgme_set_armor (ctx, NUM2INT(vyes));

  return Qnil;
}

.gpgme_set_ctx_flagObject

Context Attributes



517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
# File 'ext/gpgme/gpgme_n.c', line 517

static VALUE
rb_s_gpgme_set_ctx_flag (VALUE dummy, VALUE vctx, VALUE vname, VALUE vstr)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;
  char* name;
  char* str;

  name = StringValueCStr(vname);
  str = StringValueCStr(vstr);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  err = gpgme_set_ctx_flag(ctx, name, str);
  return LONG2NUM(err);
}

.gpgme_set_engine_infoObject



187
188
189
190
191
192
193
194
195
196
197
# File 'ext/gpgme/gpgme_n.c', line 187

static VALUE
rb_s_gpgme_set_engine_info (VALUE dummy, VALUE vproto, VALUE vfile_name,
                            VALUE vhome_dir)
{
  gpgme_error_t err = gpgme_set_engine_info (NUM2INT(vproto),
                                             NIL_P(vfile_name) ? NULL :
                                             StringValueCStr(vfile_name),
                                             NIL_P(vhome_dir) ? NULL :
                                             StringValueCStr(vhome_dir));
  return LONG2NUM(err);
}

.gpgme_set_ignore_mdc_errorObject



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
# File 'ext/gpgme/gpgme_n.c', line 609

static VALUE
rb_s_gpgme_set_ignore_mdc_error (VALUE dummy, VALUE vctx, VALUE vyes)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;
  int yes;

  yes = NUM2INT(vyes);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  err = gpgme_set_ctx_flag(ctx, "ignore-mdc-error", yes ? "1" : "");
  return LONG2NUM(err);
}

.gpgme_set_include_certsObject



670
671
672
673
674
675
676
677
678
679
680
# File 'ext/gpgme/gpgme_n.c', line 670

static VALUE
rb_s_gpgme_set_include_certs (VALUE dummy, VALUE vctx, VALUE vnr_of_certs)
{
  gpgme_ctx_t ctx;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  gpgme_set_include_certs (ctx, NUM2INT(vnr_of_certs));
  return Qnil;
}

.gpgme_set_keylist_modeObject



695
696
697
698
699
700
701
702
703
704
705
706
# File 'ext/gpgme/gpgme_n.c', line 695

static VALUE
rb_s_gpgme_set_keylist_mode (VALUE dummy, VALUE vctx, VALUE vmode)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  err = gpgme_set_keylist_mode (ctx, NUM2INT(vmode));
  return LONG2NUM(err);
}

.gpgme_set_localeObject



861
862
863
864
865
866
867
868
869
870
871
872
873
# File 'ext/gpgme/gpgme_n.c', line 861

static VALUE
rb_s_gpgme_set_locale (VALUE dummy, VALUE vctx, VALUE vcategory, VALUE vvalue)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  err = gpgme_set_locale (ctx, NUM2INT(vcategory), StringValueCStr(vvalue));
  return LONG2NUM(err);
}

.gpgme_set_offlineObject



906
907
908
909
910
911
912
913
914
915
916
917
# File 'ext/gpgme/gpgme_n.c', line 906

static VALUE
rb_s_gpgme_set_offline (VALUE dummy, VALUE vctx, VALUE vyes)
{
  gpgme_ctx_t ctx;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  gpgme_set_offline (ctx, vyes == Qtrue);
  return Qnil;
}

.gpgme_set_passphrase_cbObject



739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
# File 'ext/gpgme/gpgme_n.c', line 739

static VALUE
rb_s_gpgme_set_passphrase_cb (VALUE dummy, VALUE vctx, VALUE vpassfunc,
                              VALUE vhook_value)
{
  gpgme_ctx_t ctx;
  VALUE vcb = rb_ary_new ();

  rb_ary_push (vcb, vpassfunc);
  rb_ary_push (vcb, vhook_value);
  /* Keep a reference to avoid GC. */
  rb_iv_set (vctx, "@passphrase_cb", vcb);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  gpgme_set_passphrase_cb (ctx, passphrase_cb, (void*)vcb);
  return Qnil;
}

.gpgme_set_pinentry_modeObject



876
877
878
879
880
881
882
883
884
885
886
887
888
# File 'ext/gpgme/gpgme_n.c', line 876

static VALUE
rb_s_gpgme_set_pinentry_mode (VALUE dummy, VALUE vctx, VALUE vmode)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  err = gpgme_set_pinentry_mode (ctx, NUM2INT(vmode));
  return LONG2NUM(err);
}

.gpgme_set_progress_cbObject



831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
# File 'ext/gpgme/gpgme_n.c', line 831

static VALUE
rb_s_gpgme_set_progress_cb (VALUE dummy, VALUE vctx, VALUE vprogfunc,
                            VALUE vhook_value)
{
  gpgme_ctx_t ctx;
  VALUE vcb = rb_ary_new ();

  rb_ary_push (vcb, vprogfunc);
  rb_ary_push (vcb, vhook_value);
  /* Keep a reference to avoid GC. */
  rb_iv_set (vctx, "@progress_cb", vcb);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  gpgme_set_progress_cb (ctx, progress_cb, (void*)vcb);

  return Qnil;
}

.gpgme_set_protocolObject



557
558
559
560
561
562
563
564
565
566
567
568
# File 'ext/gpgme/gpgme_n.c', line 557

static VALUE
rb_s_gpgme_set_protocol (VALUE dummy, VALUE vctx, VALUE vproto)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  err = gpgme_set_protocol (ctx, NUM2INT(vproto));
  return LONG2NUM(err);
}

.gpgme_set_status_cbObject



786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
# File 'ext/gpgme/gpgme_n.c', line 786

static VALUE
rb_s_gpgme_set_status_cb (VALUE dummy, VALUE vctx, VALUE vstatusfunc,
                          VALUE vhook_value)
{
  gpgme_ctx_t ctx;
  VALUE vcb = rb_ary_new ();

  rb_ary_push (vcb, vstatusfunc);
  rb_ary_push (vcb, vhook_value);
  /* Keep a reference to avoid GC. */
  rb_iv_set (vctx, "@status_cb", vcb);

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  gpgme_set_status_cb (ctx, status_cb, (void*)vcb);
  return Qnil;
}

.gpgme_set_textmodeObject



645
646
647
648
649
650
651
652
653
654
655
# File 'ext/gpgme/gpgme_n.c', line 645

static VALUE
rb_s_gpgme_set_textmode (VALUE dummy, VALUE vctx, VALUE vyes)
{
  gpgme_ctx_t ctx;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  gpgme_set_textmode (ctx, NUM2INT(vyes));
  return Qnil;
}

.gpgme_signers_addObject



1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
# File 'ext/gpgme/gpgme_n.c', line 1934

static VALUE
rb_s_gpgme_signers_add (VALUE dummy, VALUE vctx, VALUE vkey)
{
  gpgme_ctx_t ctx;
  gpgme_key_t key;
  gpgme_error_t err;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  UNWRAP_GPGME_KEY(vkey, key);

  err = gpgme_signers_add (ctx, key);
  return LONG2NUM(err);
}

.gpgme_signers_clearObject

Sign



1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
# File 'ext/gpgme/gpgme_n.c', line 1922

static VALUE
rb_s_gpgme_signers_clear (VALUE dummy, VALUE vctx)
{
  gpgme_ctx_t ctx;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");
  gpgme_signers_clear (ctx);
  return Qnil;
}

.gpgme_signers_enumObject



1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
# File 'ext/gpgme/gpgme_n.c', line 1950

static VALUE
rb_s_gpgme_signers_enum (VALUE dummy, VALUE vctx, VALUE vseq)
{
  gpgme_ctx_t ctx;
  gpgme_key_t key;

  UNWRAP_GPGME_CTX(vctx, ctx);
  if (!ctx)
    rb_raise (rb_eArgError, "released ctx");

  key = gpgme_signers_enum (ctx, NUM2INT(vseq));
  if (!key)
    return Qnil;
  return WRAP_GPGME_KEY(key);
}

.gpgme_strerrorObject



276
277
278
279
280
# File 'ext/gpgme/gpgme_n.c', line 276

static VALUE
rb_s_gpgme_strerror (VALUE dummy, VALUE verr)
{
  return rb_str_new2 (gpgme_strerror (NUM2LONG(verr)));
}

.gpgme_waitObject

Run Control



2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
# File 'ext/gpgme/gpgme_n.c', line 2223

static VALUE
rb_s_gpgme_wait (VALUE dummy, VALUE vctx, VALUE rstatus, VALUE vhang)
{
  gpgme_ctx_t ctx = NULL, ret;
  gpgme_error_t status;

  /* The CTX argument can be `NULL'.  In that case, `gpgme_wait' waits
     for any context to complete its operation. */
  if (!NIL_P(vctx))
    {
      UNWRAP_GPGME_CTX(vctx, ctx);
      if (!ctx)
        rb_raise (rb_eArgError, "released ctx");
    }

  ret = gpgme_wait (ctx, &status, NUM2INT(vhang));
  if (ret)
    {
      rb_ary_store (rstatus, 0, INT2NUM(status));
      if (ret != ctx)
        vctx = WRAP_GPGME_CTX(ret);
      return vctx;
    }
  return Qnil;
}