key.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GPGMEPP_KEY_H__
00022 #define __GPGMEPP_KEY_H__
00023
00024 #include <gpgmepp/gpgmefw.h>
00025 #include <gpgmepp/context.h>
00026
00027 #include <sys/time.h>
00028
00029 #include <vector>
00030
00031 namespace GpgME {
00032
00033 class Subkey;
00034 class UserID;
00035
00036
00037
00038
00039
00040 class Key {
00041 friend class Context;
00042 public:
00043 Key();
00044 Key( gpgme_key_t key, bool acquireRef, unsigned int keyListMode=0 );
00045 Key( const Key & key );
00046 ~Key();
00047
00048 static Key null;
00049
00050 const Key & operator=( const Key & other );
00051
00052 bool isNull() const;
00053
00054 UserID userID( unsigned int index ) const;
00055 Subkey subkey( unsigned int index ) const;
00056
00057 unsigned int numUserIDs() const;
00058 unsigned int numSubkeys() const;
00059
00060 std::vector<UserID> userIDs() const;
00061 std::vector<Subkey> subkeys() const;
00062
00063 bool isRevoked() const;
00064 bool isExpired() const;
00065 bool isDisabled() const;
00066 bool isInvalid() const;
00067
00068 bool canEncrypt() const;
00069 bool canSign() const;
00070 bool canCertify() const;
00071 bool canAuthenticate() const;
00072
00073 bool hasSecret() const;
00074 bool isSecret() const { return hasSecret(); }
00075
00081 bool isRoot() const;
00082
00083 enum OwnerTrust { Unknown=0, Undefined=1, Never=2,
00084 Marginal=3, Full=4, Ultimate=5 };
00085
00086 OwnerTrust ownerTrust() const;
00087 char ownerTrustAsString() const;
00088
00089 typedef Context::Protocol Protocol;
00090 Protocol protocol() const;
00091 const char * protocolAsString() const;
00092
00093 const char * issuerSerial() const;
00094 const char * issuerName() const;
00095 const char * chainID() const;
00096
00097 const char * keyID() const;
00098 const char * shortKeyID() const;
00099 const char * primaryFingerprint() const;
00100
00101 typedef Context::KeyListMode KeyListMode;
00102 unsigned int keyListMode() const;
00103
00104 private:
00105 gpgme_key_t impl() const;
00106 class Private;
00107 Private * d;
00108 };
00109
00110
00111
00112
00113
00114 class Subkey {
00115 public:
00116 Subkey( gpgme_key_t key=0, gpgme_sub_key_t subkey=0 );
00117 Subkey( gpgme_key_t key, unsigned int idx );
00118 Subkey( const Subkey & other );
00119 ~Subkey();
00120
00121 const Subkey & operator=( const Subkey & other );
00122
00123 bool isNull() const;
00124
00125 Key parent() const;
00126
00127 const char * keyID() const;
00128 const char * fingerprint() const;
00129
00130 time_t creationTime() const;
00131 time_t expirationTime() const;
00132 bool neverExpires() const;
00133
00134 bool isRevoked() const;
00135 bool isExpired() const;
00136 bool isInvalid() const;
00137 bool isDisabled() const;
00138
00139 bool canEncrypt() const;
00140 bool canSign() const;
00141 bool canCertify() const;
00142 bool canAuthenticate() const;
00143
00144 bool isSecred() const;
00145
00146 unsigned int publicKeyAlgorithm() const;
00147 const char * publicKeyAlgorithmAsString() const;
00148
00149 unsigned int length() const;
00150
00151 private:
00152 class Private;
00153 Private * d;
00154 };
00155
00156
00157
00158
00159
00160 class UserID {
00161 public:
00162 class Signature;
00163
00164 UserID( gpgme_key_t key=0, gpgme_user_id_t uid=0 );
00165 UserID( gpgme_key_t key, unsigned int idx );
00166 UserID( const UserID & other );
00167 ~UserID();
00168
00169 const UserID & operator=( const UserID & other );
00170
00171 bool isNull() const;
00172
00173 Key parent() const;
00174
00175 unsigned int numSignatures() const;
00176 Signature signature( unsigned int index ) const;
00177 std::vector<Signature> signatures() const;
00178
00179 const char * id() const;
00180 const char * name() const;
00181 const char * email() const;
00182 const char * comment() const;
00183
00184 enum Validity { Unknown=0, Undefined=1, Never=2,
00185 Marginal=3, Full=4, Ultimate=5 };
00186
00187 Validity validity() const;
00188 char validityAsString() const;
00189
00190 bool isRevoked() const;
00191 bool isInvalid() const;
00192
00193 private:
00194 class Private;
00195 Private * d;
00196 };
00197
00198
00199
00200
00201
00202 class UserID::Signature {
00203 public:
00204 class Notation;
00205
00206 Signature( gpgme_key_t key=0, gpgme_user_id_t uid=0, gpgme_key_sig_t sig=0 );
00207 Signature( gpgme_key_t key, gpgme_user_id_t uid, unsigned int idx );
00208 Signature( const Signature & other );
00209 ~Signature();
00210
00211 const Signature & operator=( const Signature & other );
00212
00213 bool isNull() const;
00214
00215 UserID parent() const;
00216
00217 const char * signerKeyID() const;
00218
00219 const char * algorithmAsString() const;
00220 unsigned int algorithm() const;
00221 time_t creationTime() const;
00222 time_t expirationTime() const;
00223 bool neverExpires() const;
00224
00225 bool isRevokation() const;
00226 bool isInvalid() const;
00227 bool isExpired() const;
00228 bool isExportable() const;
00229
00230 const char * signerUserID() const;
00231 const char * signerName() const;
00232 const char * signerEmail() const;
00233 const char * signerComment() const;
00234
00235 unsigned int certClass() const;
00236
00237 enum Status { NoError = 0, SigExpired, KeyExpired,
00238 BadSignature, NoPublicKey, GeneralError };
00239 Status status() const;
00240 const char * statusAsString() const;
00241
00242 const char * policyURL() const;
00243
00244 unsigned int numNotations() const;
00245 Notation notation( unsigned int idx ) const;
00246 std::vector<Notation> notations() const;
00247
00248 private:
00249 class Private;
00250 Private * d;
00251 };
00252
00253
00254
00255
00256
00257
00258
00259 class UserID::Signature::Notation {
00260 public:
00261 Notation( gpgme_key_t key=0, gpgme_user_id_t uid=0,
00262 gpgme_key_sig_t sig=0, gpgme_sig_notation_t nota=0 );
00263 Notation( gpgme_key_t key, gpgme_user_id_t uid,
00264 gpgme_key_sig_t sig, unsigned int idx );
00265 Notation( const Notation & other );
00266 ~Notation();
00267
00268 const Notation & operator=( const Notation & other );
00269
00270 bool isNull() const;
00271
00272 Signature parent() const;
00273
00274 const char * name() const;
00275 const char * value() const;
00276
00277 private:
00278 class Private;
00279 Private * d;
00280 };
00281
00282 }
00283
00284 #endif
This file is part of the documentation for libkdenetwork Library Version 3.3.0.