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 =
"1.0.8"
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
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_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
PK_DSA =
GPGME_PK_DSA
PK_ELG =
GPGME_PK_ELG
PK_ELG_E =
GPGME_PK_ELG_E
PK_RSA =
GPGME_PK_RSA
PROTOCOL_CMS =
GPGME_PROTOCOL_CMS
PROTOCOL_OpenPGP =
GPGME_PROTOCOL_OpenPGP
PROTOCOL_ASSUAN =
GPGME_PROTOCOL_ASSUAN
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_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
}
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
}
PINENTRY_MODE_NAMES =
{
  PINENTRY_MODE_DEFAULT  => :default,
  PINENTRY_MODE_ASK      => :ask,
  PINENTRY_MODE_CANCEL   => :cancel,
  PINENTRY_MODE_ERROR    => :error,
  PINENTRY_MODE_LOOPBACK => :loopback
}
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_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_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 =

gpgme_status_code_t

INT2FIX(GPGME_PROTOCOL_ASSUAN))
#endif

  /* gpgme_status_code_t */
  rb_define_const (mGPGME, "GPGME_STATUS_EOF",
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_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_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)

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.


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

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.


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
89
90
# File 'lib/gpgme.rb', line 33

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


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

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_data_get_encodingObject


393
394
395
396
397
398
399
400
401
402
# File 'ext/gpgme/gpgme_n.c', line 393

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_newObject

Creating Data Buffers

gpgme_data_new_from_filepart is not currently supported.


226
227
228
229
230
231
232
233
234
235
# File 'ext/gpgme/gpgme_n.c', line 226

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


325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'ext/gpgme/gpgme_n.c', line 325

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


258
259
260
261
262
263
264
265
266
# File 'ext/gpgme/gpgme_n.c', line 258

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


237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'ext/gpgme/gpgme_n.c', line 237

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


347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'ext/gpgme/gpgme_n.c', line 347

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


367
368
369
370
371
372
373
374
375
376
377
378
# File 'ext/gpgme/gpgme_n.c', line 367

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


404
405
406
407
408
409
410
411
412
413
# File 'ext/gpgme/gpgme_n.c', line 404

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_writeObject


380
381
382
383
384
385
386
387
388
389
390
391
# File 'ext/gpgme/gpgme_n.c', line 380

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


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

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


208
209
210
211
212
# File 'ext/gpgme/gpgme_n.c', line 208

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

.gpgme_err_sourceObject


214
215
216
217
218
# File 'ext/gpgme/gpgme_n.c', line 214

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

.gpgme_get_armorObject


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

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_engine_infoObject


150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'ext/gpgme/gpgme_n.c', line 150

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_include_certsObject


528
529
530
531
532
533
534
535
536
537
538
539
# File 'ext/gpgme/gpgme_n.c', line 528

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


890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
# File 'ext/gpgme/gpgme_n.c', line 890

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


554
555
556
557
558
559
560
561
562
563
564
565
# File 'ext/gpgme/gpgme_n.c', line 554

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_passphrase_cbObject


604
605
606
607
608
609
610
611
612
613
614
# File 'ext/gpgme/gpgme_n.c', line 604

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


688
689
690
691
692
693
694
695
696
697
698
699
700
# File 'ext/gpgme/gpgme_n.c', line 688

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


649
650
651
652
653
654
655
656
657
# File 'ext/gpgme/gpgme_n.c', line 649

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


452
453
454
455
456
457
458
459
460
461
462
463
# File 'ext/gpgme/gpgme_n.c', line 452

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_textmodeObject


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

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


199
200
201
202
203
204
205
206
# File 'ext/gpgme/gpgme_n.c', line 199

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


415
416
417
418
419
420
421
422
423
424
# File 'ext/gpgme/gpgme_n.c', line 415

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


1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
# File 'ext/gpgme/gpgme_n.c', line 1333

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


1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
# File 'ext/gpgme/gpgme_n.c', line 1362

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


1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
# File 'ext/gpgme/gpgme_n.c', line 1455

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


1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
# File 'ext/gpgme/gpgme_n.c', line 1494

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);
  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);
    }
  rb_iv_set (vresult, "@file_name", rb_str_new2 (result->file_name));
  return vresult;
}

.gpgme_op_decrypt_startObject


1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
# File 'ext/gpgme/gpgme_n.c', line 1474

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


1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
# File 'ext/gpgme/gpgme_n.c', line 1630

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


1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
# File 'ext/gpgme/gpgme_n.c', line 1650

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


1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
# File 'ext/gpgme/gpgme_n.c', line 1224

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


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

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


1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
# File 'ext/gpgme/gpgme_n.c', line 1275

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


1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
# File 'ext/gpgme/gpgme_n.c', line 1304

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


1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
# File 'ext/gpgme/gpgme_n.c', line 1802

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


1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
# File 'ext/gpgme/gpgme_n.c', line 1868

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);
  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


1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
# File 'ext/gpgme/gpgme_n.c', line 1898

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


1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
# File 'ext/gpgme/gpgme_n.c', line 1931

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


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
# File 'ext/gpgme/gpgme_n.c', line 1835

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


956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
# File 'ext/gpgme/gpgme_n.c', line 956

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


996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
# File 'ext/gpgme/gpgme_n.c', line 996

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


1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
# File 'ext/gpgme/gpgme_n.c', line 1020

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


1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
# File 'ext/gpgme/gpgme_n.c', line 1045

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


1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
# File 'ext/gpgme/gpgme_n.c', line 1071

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


976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
# File 'ext/gpgme/gpgme_n.c', line 976

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


912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
# File 'ext/gpgme/gpgme_n.c', line 912

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


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

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


1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
# File 'ext/gpgme/gpgme_n.c', line 1098

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


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

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


1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
# File 'ext/gpgme/gpgme_n.c', line 1158

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


1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
# File 'ext/gpgme/gpgme_n.c', line 1182

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);
  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


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

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


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

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


724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
# File 'ext/gpgme/gpgme_n.c', line 724

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


850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
# File 'ext/gpgme/gpgme_n.c', line 850

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


703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
# File 'ext/gpgme/gpgme_n.c', line 703

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


1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
# File 'ext/gpgme/gpgme_n.c', line 1714

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


1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
# File 'ext/gpgme/gpgme_n.c', line 1754

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);
  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


1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
# File 'ext/gpgme/gpgme_n.c', line 1734

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_trustlist_endObject


1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
# File 'ext/gpgme/gpgme_n.c', line 1439

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


1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
# File 'ext/gpgme/gpgme_n.c', line 1408

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


1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
# File 'ext/gpgme/gpgme_n.c', line 1391

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


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 1526

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


1572
1573
1574
1575
1576
1577
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
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
# File 'ext/gpgme/gpgme_n.c', line 1572

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);
  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


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

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


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

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


426
427
428
429
430
431
432
433
434
435
436
437
# File 'ext/gpgme/gpgme_n.c', line 426

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


465
466
467
468
469
470
471
472
473
474
475
476
# File 'ext/gpgme/gpgme_n.c', line 465

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_engine_infoObject


178
179
180
181
182
183
184
185
186
187
188
# File 'ext/gpgme/gpgme_n.c', line 178

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_include_certsObject


516
517
518
519
520
521
522
523
524
525
526
# File 'ext/gpgme/gpgme_n.c', line 516

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


541
542
543
544
545
546
547
548
549
550
551
552
# File 'ext/gpgme/gpgme_n.c', line 541

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


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

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_passphrase_cbObject


585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'ext/gpgme/gpgme_n.c', line 585

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


674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'ext/gpgme/gpgme_n.c', line 674

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


629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
# File 'ext/gpgme/gpgme_n.c', line 629

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

Context Attributes


439
440
441
442
443
444
445
446
447
448
449
450
# File 'ext/gpgme/gpgme_n.c', line 439

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_textmodeObject


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

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


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

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


1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
# File 'ext/gpgme/gpgme_n.c', line 1670

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


1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
# File 'ext/gpgme/gpgme_n.c', line 1698

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


220
221
222
223
224
# File 'ext/gpgme/gpgme_n.c', line 220

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

.gpgme_waitObject

Run Control


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

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;
}