mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-24 22:26:52 -05:00
patched openpgpsdkfor c++ compilation, added test program, started retroshare PGPHandler component
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5050 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7d06d19e40
commit
4299d09741
38
README.txt
Normal file
38
README.txt
Normal file
@ -0,0 +1,38 @@
|
||||
To use this branch:
|
||||
|
||||
chekcout the last version of openpgp SDK:
|
||||
# svn co svn://openpgp.nominet.org.uk/openpgpsdk/tags/openpgpsdk-0.9 openpgpsdk
|
||||
# cd openpgpsdk
|
||||
# ./configure --without-idea
|
||||
# make
|
||||
|
||||
For the moment, the compilation is not workign on ubuntu
|
||||
|
||||
Work to do
|
||||
==========
|
||||
Put a 'x' when done. 1,2,3 means started/ongoing/almost finished.
|
||||
|
||||
Compilation
|
||||
00 [1] make sure the library compiles on linux
|
||||
01 [ ] make sure the library compiles on windows
|
||||
|
||||
Project
|
||||
02 [1] determine what's missing in OpenPGP-SDK
|
||||
03 [ ] make a separate layer in RS to handle PGP. AuthPGP is too close to libretroshare.
|
||||
|
||||
Notes
|
||||
=====
|
||||
Questions to answer:
|
||||
- do we rely on updates from openPGP-sdk ? Probably not. This code seems frozen.
|
||||
- do we need an abstract layer for PGP handling in RS ?
|
||||
- what new functionalities do we need in RS ?
|
||||
* pgp keyring sharing/import/export
|
||||
* identity import/export
|
||||
|
||||
Code struture
|
||||
- replace current AuthGPG (virtual class) by a class named GPGHandler,
|
||||
that is responsible for signing, checking signatures, encrypting etc.
|
||||
- add a specific 8-bytes type for GPG Ids. Could be a uint64_t, or a
|
||||
uchar[8]
|
||||
|
||||
|
@ -183,6 +183,9 @@ linux-* {
|
||||
INCLUDEPATH *= /usr/lib/x86_64-linux-gnu/glib-2.0/include/
|
||||
INCLUDEPATH *= /usr/lib/i386-linux-gnu/glib-2.0/include/
|
||||
|
||||
OPENPGPSDK_DIR = ../../openpgpsdk/include
|
||||
INCLUDEPATH *= $${OPENPGPSDK_DIR}
|
||||
|
||||
DESTDIR = lib
|
||||
QMAKE_CXXFLAGS *= -Wall -D_FILE_OFFSET_BITS=64
|
||||
QMAKE_CC = g++
|
||||
@ -372,6 +375,7 @@ HEADERS += ft/ftchunkmap.h \
|
||||
|
||||
HEADERS += pqi/authssl.h \
|
||||
pqi/authgpg.h \
|
||||
pgp/pgphandler.h \
|
||||
pqi/cleanupxpgp.h \
|
||||
pqi/p3cfgmgr.h \
|
||||
pqi/p3peermgr.h \
|
||||
@ -511,6 +515,7 @@ SOURCES += ft/ftchunkmap.cc \
|
||||
|
||||
SOURCES += pqi/authgpg.cc \
|
||||
pqi/authssl.cc \
|
||||
pgp/pgphandler.cc \
|
||||
pqi/cleanupxpgp.cc \
|
||||
pqi/p3cfgmgr.cc \
|
||||
pqi/p3peermgr.cc \
|
||||
|
89
libretroshare/src/pgp/pgphandler.cc
Normal file
89
libretroshare/src/pgp/pgphandler.cc
Normal file
@ -0,0 +1,89 @@
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <stdlib.h>
|
||||
|
||||
extern "C" {
|
||||
#include <openpgpsdk/util.h>
|
||||
}
|
||||
#include "pgphandler.h"
|
||||
|
||||
std::string PGPIdType::toStdString() const
|
||||
{
|
||||
std::ostringstream tmpout;
|
||||
|
||||
for(int j = 0; j < KEY_ID_SIZE; j++)
|
||||
tmpout << std::setw(2) << std::setfill('0') << std::hex << (int)bytes[j] ;
|
||||
|
||||
return tmpout.str() ;
|
||||
}
|
||||
|
||||
PGPIdType::PGPIdType(const std::string& s)
|
||||
{
|
||||
int n=0;
|
||||
if(s.length() != KEY_ID_SIZE*2)
|
||||
throw std::runtime_error("PGPIdType::PGPIdType: can only init from 16 chars hexadecimal string") ;
|
||||
|
||||
for(int i = 0; i < KEY_ID_SIZE; ++i)
|
||||
{
|
||||
bytes[i] = 0 ;
|
||||
|
||||
for(int k=0;k<2;++k)
|
||||
{
|
||||
char b = s[n++] ;
|
||||
|
||||
if(b >= 'A' && b <= 'F')
|
||||
bytes[i] += (b-'A'+10) << 4*(1-k) ;
|
||||
else if(b >= 'a' && b <= 'f')
|
||||
bytes[i] += (b-'a'+10) << 4*(1-k) ;
|
||||
else if(b >= '0' && b <= '9')
|
||||
bytes[i] += (b-'0') << 4*(1-k) ;
|
||||
else
|
||||
throw std::runtime_error("PGPIdType::Sha1CheckSum: can't init from non pure hexadecimal string") ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t PGPIdType::toUInt64() const
|
||||
{
|
||||
uint64_t res = 0 ;
|
||||
|
||||
for(int i=0;i<KEY_ID_SIZE;++i)
|
||||
res = (res << 8) + bytes[i] ;
|
||||
|
||||
return res ;
|
||||
}
|
||||
|
||||
PGPHandler::PGPHandler(const std::string& pubring, const std::string& secring)
|
||||
:_pubring_path(pubring),_secring_path(secring),
|
||||
pgphandlerMtx(std::string("PGPHandler"))
|
||||
{
|
||||
// Allocate public and secret keyrings.
|
||||
//
|
||||
_pubring = (ops_keyring_t*)malloc(sizeof(ops_keyring_t)) ;
|
||||
_secring = (ops_keyring_t*)malloc(sizeof(ops_keyring_t)) ;
|
||||
|
||||
// Read public and secret keyrings from supplied files.
|
||||
//
|
||||
if(ops_false == ops_keyring_read_from_file(_pubring, false, pubring.c_str()))
|
||||
throw std::runtime_error("PGPHandler::readKeyRing(): cannot read pubring.") ;
|
||||
|
||||
std::cerr << "Pubring read successfully." << std::endl;
|
||||
|
||||
if(ops_false == ops_keyring_read_from_file(_secring, false, secring.c_str()))
|
||||
throw std::runtime_error("PGPHandler::readKeyRing(): cannot read secring.") ;
|
||||
|
||||
std::cerr << "Secring read successfully." << std::endl;
|
||||
}
|
||||
|
||||
PGPHandler::~PGPHandler()
|
||||
{
|
||||
std::cerr << "Freeing PGPHandler. Deleting keyrings." << std::endl;
|
||||
|
||||
ops_keyring_free(_pubring) ;
|
||||
ops_keyring_free(_secring) ;
|
||||
|
||||
free(_pubring) ;
|
||||
free(_secring) ;
|
||||
}
|
61
libretroshare/src/pgp/pgphandler.h
Normal file
61
libretroshare/src/pgp/pgphandler.h
Normal file
@ -0,0 +1,61 @@
|
||||
// This class implements an abstract pgp handler to be used in RetroShare.
|
||||
//
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <util/rsthreads.h>
|
||||
|
||||
extern "C" {
|
||||
#include <openpgpsdk/types.h>
|
||||
#include <openpgpsdk/keyring.h>
|
||||
}
|
||||
|
||||
class PGPIdType
|
||||
{
|
||||
public:
|
||||
static const int KEY_ID_SIZE = 8 ;
|
||||
|
||||
PGPIdType(const std::string& hex_string) ;
|
||||
PGPIdType(const unsigned char bytes[]) ;
|
||||
|
||||
std::string toStdString() const ;
|
||||
uint64_t toUInt64() const ;
|
||||
|
||||
private:
|
||||
unsigned char bytes[KEY_ID_SIZE] ;
|
||||
};
|
||||
|
||||
class PGPHandler
|
||||
{
|
||||
public:
|
||||
PGPHandler(const std::string& path_to_public_keyring, const std::string& path_to_secret_keyring) ;
|
||||
|
||||
virtual ~PGPHandler() ;
|
||||
|
||||
/**
|
||||
* @param ids list of gpg certificate ids (note, not the actual certificates)
|
||||
*/
|
||||
|
||||
bool availableGPGCertificatesWithPrivateKeys(std::list<PGPIdType>& ids);
|
||||
bool GeneratePGPCertificate(const std::string& name, const std::string& email, const std::string& passwd, PGPIdType& pgpId, std::string& errString) ;
|
||||
|
||||
bool LoadCertificateFromString(const std::string& pem, PGPIdType& gpg_id, std::string& error_string);
|
||||
std::string SaveCertificateToString(const PGPIdType& id,bool include_signatures) ;
|
||||
|
||||
bool TrustCertificate(const PGPIdType& id, int trustlvl);
|
||||
|
||||
virtual bool SignDataBin(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen) { return false ; }
|
||||
virtual bool VerifySignBin(const void*, uint32_t, unsigned char*, unsigned int, const std::string &withfingerprint) { return false ; }
|
||||
|
||||
// Debug stuff.
|
||||
virtual bool printKeys() { return false;}
|
||||
|
||||
private:
|
||||
RsMutex pgphandlerMtx ;
|
||||
|
||||
ops_keyring_t *_pubring ;
|
||||
ops_keyring_t *_secring ;
|
||||
|
||||
const std::string _pubring_path ;
|
||||
const std::string _secring_path ;
|
||||
};
|
25
libretroshare/src/pgp/test_pgp_handler.cc
Normal file
25
libretroshare/src/pgp/test_pgp_handler.cc
Normal file
@ -0,0 +1,25 @@
|
||||
// COMPILE_LINE: g++ -o test_pgp_handler test_pgp_handler.cc -I../../../openpgpsdk/include -I../ -L../lib -lretroshare ../../../openpgpsdk/lib/libops.a -lssl -lcrypto -lbz2
|
||||
//
|
||||
#include <iostream>
|
||||
#include "pgphandler.h"
|
||||
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
// test pgp ids.
|
||||
//
|
||||
PGPIdType id("3e5b22140ef56abb") ;
|
||||
|
||||
std::cerr << "Id is : " << std::hex << id.toUInt64() << std::endl;
|
||||
std::cerr << "Id st : " << id.toStdString() << std::endl;
|
||||
|
||||
// test PGPHandler
|
||||
//
|
||||
// 0 - init
|
||||
|
||||
static const std::string pubring = "pubring.gpg" ;
|
||||
static const std::string secring = "secring.gpg" ;
|
||||
|
||||
PGPHandler pgph(pubring,secring) ;
|
||||
|
||||
return 0 ;
|
||||
}
|
@ -132,14 +132,6 @@ int ops_parse_errs(ops_parse_info_t *parse_info,ops_ulong_list_t *errs);
|
||||
|
||||
void ops_parse_and_validate(ops_parse_info_t *parse_info);
|
||||
|
||||
/** Used to specify whether subpackets should be returned raw, parsed or ignored.
|
||||
*/
|
||||
enum ops_parse_type_t
|
||||
{
|
||||
OPS_PARSE_RAW, /*!< Callback Raw */
|
||||
OPS_PARSE_PARSED, /*!< Callback Parsed */
|
||||
OPS_PARSE_IGNORE, /*!< Don't callback */
|
||||
};
|
||||
|
||||
void ops_parse_options(ops_parse_info_t *pinfo,ops_content_tag_t tag,
|
||||
ops_parse_type_t type);
|
||||
|
@ -128,116 +128,6 @@ typedef enum
|
||||
|
||||
|
||||
|
||||
/* PTag Content Tags */
|
||||
/***************************/
|
||||
|
||||
/** Package Tags (aka Content Tags) and signature subpacket types.
|
||||
* This enumerates all rfc-defined packet tag values and the
|
||||
* signature subpacket type values that we understand.
|
||||
*
|
||||
* \see RFC4880 4.3
|
||||
* \see RFC4880 5.2.3.1
|
||||
*/
|
||||
enum ops_content_tag_t
|
||||
{
|
||||
OPS_PTAG_CT_RESERVED = 0, /*!< Reserved - a packet tag must not have this value */
|
||||
OPS_PTAG_CT_PK_SESSION_KEY = 1, /*!< Public-Key Encrypted Session Key Packet */
|
||||
OPS_PTAG_CT_SIGNATURE = 2, /*!< Signature Packet */
|
||||
OPS_PTAG_CT_SK_SESSION_KEY = 3, /*!< Symmetric-Key Encrypted Session Key Packet */
|
||||
OPS_PTAG_CT_ONE_PASS_SIGNATURE = 4, /*!< One-Pass Signature Packet */
|
||||
OPS_PTAG_CT_SECRET_KEY = 5, /*!< Secret Key Packet */
|
||||
OPS_PTAG_CT_PUBLIC_KEY = 6, /*!< Public Key Packet */
|
||||
OPS_PTAG_CT_SECRET_SUBKEY = 7, /*!< Secret Subkey Packet */
|
||||
OPS_PTAG_CT_COMPRESSED = 8, /*!< Compressed Data Packet */
|
||||
OPS_PTAG_CT_SE_DATA = 9, /*!< Symmetrically Encrypted Data Packet */
|
||||
OPS_PTAG_CT_MARKER =10, /*!< Marker Packet */
|
||||
OPS_PTAG_CT_LITERAL_DATA =11, /*!< Literal Data Packet */
|
||||
OPS_PTAG_CT_TRUST =12, /*!< Trust Packet */
|
||||
OPS_PTAG_CT_USER_ID =13, /*!< User ID Packet */
|
||||
OPS_PTAG_CT_PUBLIC_SUBKEY =14, /*!< Public Subkey Packet */
|
||||
OPS_PTAG_CT_RESERVED2 =15, /*!< reserved */
|
||||
OPS_PTAG_CT_RESERVED3 =16, /*!< reserved */
|
||||
OPS_PTAG_CT_USER_ATTRIBUTE =17, /*!< User Attribute Packet */
|
||||
OPS_PTAG_CT_SE_IP_DATA =18, /*!< Sym. Encrypted and Integrity Protected Data Packet */
|
||||
OPS_PTAG_CT_MDC =19, /*!< Modification Detection Code Packet */
|
||||
|
||||
OPS_PARSER_PTAG =0x100, /*!< Internal Use: The packet is the "Packet Tag" itself - used when
|
||||
callback sends back the PTag. */
|
||||
OPS_PTAG_RAW_SS =0x101, /*!< Internal Use: content is raw sig subtag */
|
||||
OPS_PTAG_SS_ALL =0x102, /*!< Internal Use: select all subtags */
|
||||
OPS_PARSER_PACKET_END =0x103,
|
||||
|
||||
/* signature subpackets (0x200-2ff) (type+0x200) */
|
||||
/* only those we can parse are listed here */
|
||||
OPS_PTAG_SIGNATURE_SUBPACKET_BASE =0x200, /*!< Base for signature subpacket types - All signature type
|
||||
values are relative to this value. */
|
||||
OPS_PTAG_SS_CREATION_TIME =0x200+2, /*!< signature creation time */
|
||||
OPS_PTAG_SS_EXPIRATION_TIME =0x200+3, /*!< signature expiration time */
|
||||
|
||||
OPS_PTAG_SS_EXPORTABLE_CERTIFICATION =0x200+4, /*!< exportable certification */
|
||||
OPS_PTAG_SS_TRUST =0x200+5, /*!< trust signature */
|
||||
OPS_PTAG_SS_REGEXP =0x200+6, /*!< regular expression */
|
||||
OPS_PTAG_SS_REVOCABLE =0x200+7, /*!< revocable */
|
||||
OPS_PTAG_SS_KEY_EXPIRATION_TIME =0x200+9, /*!< key expiration time */
|
||||
OPS_PTAG_SS_RESERVED =0x200+10, /*!< reserved */
|
||||
OPS_PTAG_SS_PREFERRED_SKA =0x200+11, /*!< preferred symmetric algorithms */
|
||||
OPS_PTAG_SS_REVOCATION_KEY =0x200+12, /*!< revocation key */
|
||||
OPS_PTAG_SS_ISSUER_KEY_ID =0x200+16, /*!< issuer key ID */
|
||||
OPS_PTAG_SS_NOTATION_DATA =0x200+20, /*!< notation data */
|
||||
OPS_PTAG_SS_PREFERRED_HASH =0x200+21, /*!< preferred hash algorithms */
|
||||
OPS_PTAG_SS_PREFERRED_COMPRESSION =0x200+22, /*!< preferred compression algorithms */
|
||||
OPS_PTAG_SS_KEY_SERVER_PREFS =0x200+23, /*!< key server preferences */
|
||||
OPS_PTAG_SS_PREFERRED_KEY_SERVER =0x200+24, /*!< Preferred Key Server */
|
||||
OPS_PTAG_SS_PRIMARY_USER_ID =0x200+25, /*!< primary User ID */
|
||||
OPS_PTAG_SS_POLICY_URI =0x200+26, /*!< Policy URI */
|
||||
OPS_PTAG_SS_KEY_FLAGS =0x200+27, /*!< key flags */
|
||||
OPS_PTAG_SS_SIGNERS_USER_ID =0x200+28, /*!< Signer's User ID */
|
||||
OPS_PTAG_SS_REVOCATION_REASON =0x200+29, /*!< reason for revocation */
|
||||
OPS_PTAG_SS_FEATURES =0x200+30, /*!< features */
|
||||
OPS_PTAG_SS_SIGNATURE_TARGET =0x200+31, /*!< signature target */
|
||||
OPS_PTAG_SS_EMBEDDED_SIGNATURE=0x200+32, /*!< embedded signature */
|
||||
|
||||
OPS_PTAG_SS_USERDEFINED00 =0x200+100, /*!< internal or user-defined */
|
||||
OPS_PTAG_SS_USERDEFINED01 =0x200+101,
|
||||
OPS_PTAG_SS_USERDEFINED02 =0x200+102,
|
||||
OPS_PTAG_SS_USERDEFINED03 =0x200+103,
|
||||
OPS_PTAG_SS_USERDEFINED04 =0x200+104,
|
||||
OPS_PTAG_SS_USERDEFINED05 =0x200+105,
|
||||
OPS_PTAG_SS_USERDEFINED06 =0x200+106,
|
||||
OPS_PTAG_SS_USERDEFINED07 =0x200+107,
|
||||
OPS_PTAG_SS_USERDEFINED08 =0x200+108,
|
||||
OPS_PTAG_SS_USERDEFINED09 =0x200+109,
|
||||
OPS_PTAG_SS_USERDEFINED10 =0x200+110,
|
||||
|
||||
|
||||
/* pseudo content types */
|
||||
OPS_PTAG_CT_LITERAL_DATA_HEADER =0x300,
|
||||
OPS_PTAG_CT_LITERAL_DATA_BODY =0x300+1,
|
||||
OPS_PTAG_CT_SIGNATURE_HEADER =0x300+2,
|
||||
OPS_PTAG_CT_SIGNATURE_FOOTER =0x300+3,
|
||||
OPS_PTAG_CT_ARMOUR_HEADER =0x300+4,
|
||||
OPS_PTAG_CT_ARMOUR_TRAILER =0x300+5,
|
||||
OPS_PTAG_CT_SIGNED_CLEARTEXT_HEADER =0x300+6,
|
||||
OPS_PTAG_CT_SIGNED_CLEARTEXT_BODY =0x300+7,
|
||||
OPS_PTAG_CT_SIGNED_CLEARTEXT_TRAILER=0x300+8,
|
||||
OPS_PTAG_CT_UNARMOURED_TEXT =0x300+9,
|
||||
OPS_PTAG_CT_ENCRYPTED_SECRET_KEY =0x300+10, // In this case the algorithm specific fields will not be initialised
|
||||
OPS_PTAG_CT_SE_DATA_HEADER =0x300+11,
|
||||
OPS_PTAG_CT_SE_DATA_BODY =0x300+12,
|
||||
OPS_PTAG_CT_SE_IP_DATA_HEADER =0x300+13,
|
||||
OPS_PTAG_CT_SE_IP_DATA_BODY =0x300+14,
|
||||
OPS_PTAG_CT_ENCRYPTED_PK_SESSION_KEY=0x300+15,
|
||||
|
||||
/* commands to the callback */
|
||||
OPS_PARSER_CMD_GET_SK_PASSPHRASE =0x400,
|
||||
OPS_PARSER_CMD_GET_SECRET_KEY =0x400+1,
|
||||
|
||||
|
||||
/* Errors */
|
||||
OPS_PARSER_ERROR =0x500, /*!< Internal Use: Parser Error */
|
||||
OPS_PARSER_ERRCODE =0x500+1, /*! < Internal Use: Parser Error with errcode returned */
|
||||
};
|
||||
|
||||
/** Structure to hold one parse error string. */
|
||||
typedef struct
|
||||
{
|
||||
@ -768,7 +658,7 @@ typedef struct
|
||||
/** Signature Subpacket : Revocation Key */
|
||||
typedef struct
|
||||
{
|
||||
unsigned char class;
|
||||
unsigned char cclass;
|
||||
unsigned char algid;
|
||||
unsigned char fingerprint[20];
|
||||
} ops_ss_revocation_key_t;
|
||||
|
@ -43,7 +43,127 @@ typedef struct
|
||||
typedef unsigned ops_boolean_t;
|
||||
|
||||
/** ops_content_tag_t */
|
||||
typedef enum ops_content_tag_t ops_content_tag_t;
|
||||
|
||||
/* PTag Content Tags */
|
||||
/***************************/
|
||||
|
||||
/** Package Tags (aka Content Tags) and signature subpacket types.
|
||||
* This enumerates all rfc-defined packet tag values and the
|
||||
* signature subpacket type values that we understand.
|
||||
*
|
||||
* \see RFC4880 4.3
|
||||
* \see RFC4880 5.2.3.1
|
||||
*/
|
||||
|
||||
enum ops_content_tag_t
|
||||
{
|
||||
OPS_PTAG_CT_RESERVED = 0, /*!< Reserved - a packet tag must not have this value */
|
||||
OPS_PTAG_CT_PK_SESSION_KEY = 1, /*!< Public-Key Encrypted Session Key Packet */
|
||||
OPS_PTAG_CT_SIGNATURE = 2, /*!< Signature Packet */
|
||||
OPS_PTAG_CT_SK_SESSION_KEY = 3, /*!< Symmetric-Key Encrypted Session Key Packet */
|
||||
OPS_PTAG_CT_ONE_PASS_SIGNATURE = 4, /*!< One-Pass Signature Packet */
|
||||
OPS_PTAG_CT_SECRET_KEY = 5, /*!< Secret Key Packet */
|
||||
OPS_PTAG_CT_PUBLIC_KEY = 6, /*!< Public Key Packet */
|
||||
OPS_PTAG_CT_SECRET_SUBKEY = 7, /*!< Secret Subkey Packet */
|
||||
OPS_PTAG_CT_COMPRESSED = 8, /*!< Compressed Data Packet */
|
||||
OPS_PTAG_CT_SE_DATA = 9, /*!< Symmetrically Encrypted Data Packet */
|
||||
OPS_PTAG_CT_MARKER =10, /*!< Marker Packet */
|
||||
OPS_PTAG_CT_LITERAL_DATA =11, /*!< Literal Data Packet */
|
||||
OPS_PTAG_CT_TRUST =12, /*!< Trust Packet */
|
||||
OPS_PTAG_CT_USER_ID =13, /*!< User ID Packet */
|
||||
OPS_PTAG_CT_PUBLIC_SUBKEY =14, /*!< Public Subkey Packet */
|
||||
OPS_PTAG_CT_RESERVED2 =15, /*!< reserved */
|
||||
OPS_PTAG_CT_RESERVED3 =16, /*!< reserved */
|
||||
OPS_PTAG_CT_USER_ATTRIBUTE =17, /*!< User Attribute Packet */
|
||||
OPS_PTAG_CT_SE_IP_DATA =18, /*!< Sym. Encrypted and Integrity Protected Data Packet */
|
||||
OPS_PTAG_CT_MDC =19, /*!< Modification Detection Code Packet */
|
||||
|
||||
OPS_PARSER_PTAG =0x100, /*!< Internal Use: The packet is the "Packet Tag" itself - used when
|
||||
callback sends back the PTag. */
|
||||
OPS_PTAG_RAW_SS =0x101, /*!< Internal Use: content is raw sig subtag */
|
||||
OPS_PTAG_SS_ALL =0x102, /*!< Internal Use: select all subtags */
|
||||
OPS_PARSER_PACKET_END =0x103,
|
||||
|
||||
/* signature subpackets (0x200-2ff) (type+0x200) */
|
||||
/* only those we can parse are listed here */
|
||||
OPS_PTAG_SIGNATURE_SUBPACKET_BASE =0x200, /*!< Base for signature subpacket types - All signature type
|
||||
values are relative to this value. */
|
||||
OPS_PTAG_SS_CREATION_TIME =0x200+2, /*!< signature creation time */
|
||||
OPS_PTAG_SS_EXPIRATION_TIME =0x200+3, /*!< signature expiration time */
|
||||
|
||||
OPS_PTAG_SS_EXPORTABLE_CERTIFICATION =0x200+4, /*!< exportable certification */
|
||||
OPS_PTAG_SS_TRUST =0x200+5, /*!< trust signature */
|
||||
OPS_PTAG_SS_REGEXP =0x200+6, /*!< regular expression */
|
||||
OPS_PTAG_SS_REVOCABLE =0x200+7, /*!< revocable */
|
||||
OPS_PTAG_SS_KEY_EXPIRATION_TIME =0x200+9, /*!< key expiration time */
|
||||
OPS_PTAG_SS_RESERVED =0x200+10, /*!< reserved */
|
||||
OPS_PTAG_SS_PREFERRED_SKA =0x200+11, /*!< preferred symmetric algorithms */
|
||||
OPS_PTAG_SS_REVOCATION_KEY =0x200+12, /*!< revocation key */
|
||||
OPS_PTAG_SS_ISSUER_KEY_ID =0x200+16, /*!< issuer key ID */
|
||||
OPS_PTAG_SS_NOTATION_DATA =0x200+20, /*!< notation data */
|
||||
OPS_PTAG_SS_PREFERRED_HASH =0x200+21, /*!< preferred hash algorithms */
|
||||
OPS_PTAG_SS_PREFERRED_COMPRESSION =0x200+22, /*!< preferred compression algorithms */
|
||||
OPS_PTAG_SS_KEY_SERVER_PREFS =0x200+23, /*!< key server preferences */
|
||||
OPS_PTAG_SS_PREFERRED_KEY_SERVER =0x200+24, /*!< Preferred Key Server */
|
||||
OPS_PTAG_SS_PRIMARY_USER_ID =0x200+25, /*!< primary User ID */
|
||||
OPS_PTAG_SS_POLICY_URI =0x200+26, /*!< Policy URI */
|
||||
OPS_PTAG_SS_KEY_FLAGS =0x200+27, /*!< key flags */
|
||||
OPS_PTAG_SS_SIGNERS_USER_ID =0x200+28, /*!< Signer's User ID */
|
||||
OPS_PTAG_SS_REVOCATION_REASON =0x200+29, /*!< reason for revocation */
|
||||
OPS_PTAG_SS_FEATURES =0x200+30, /*!< features */
|
||||
OPS_PTAG_SS_SIGNATURE_TARGET =0x200+31, /*!< signature target */
|
||||
OPS_PTAG_SS_EMBEDDED_SIGNATURE=0x200+32, /*!< embedded signature */
|
||||
|
||||
OPS_PTAG_SS_USERDEFINED00 =0x200+100, /*!< internal or user-defined */
|
||||
OPS_PTAG_SS_USERDEFINED01 =0x200+101,
|
||||
OPS_PTAG_SS_USERDEFINED02 =0x200+102,
|
||||
OPS_PTAG_SS_USERDEFINED03 =0x200+103,
|
||||
OPS_PTAG_SS_USERDEFINED04 =0x200+104,
|
||||
OPS_PTAG_SS_USERDEFINED05 =0x200+105,
|
||||
OPS_PTAG_SS_USERDEFINED06 =0x200+106,
|
||||
OPS_PTAG_SS_USERDEFINED07 =0x200+107,
|
||||
OPS_PTAG_SS_USERDEFINED08 =0x200+108,
|
||||
OPS_PTAG_SS_USERDEFINED09 =0x200+109,
|
||||
OPS_PTAG_SS_USERDEFINED10 =0x200+110,
|
||||
|
||||
|
||||
/* pseudo content types */
|
||||
OPS_PTAG_CT_LITERAL_DATA_HEADER =0x300,
|
||||
OPS_PTAG_CT_LITERAL_DATA_BODY =0x300+1,
|
||||
OPS_PTAG_CT_SIGNATURE_HEADER =0x300+2,
|
||||
OPS_PTAG_CT_SIGNATURE_FOOTER =0x300+3,
|
||||
OPS_PTAG_CT_ARMOUR_HEADER =0x300+4,
|
||||
OPS_PTAG_CT_ARMOUR_TRAILER =0x300+5,
|
||||
OPS_PTAG_CT_SIGNED_CLEARTEXT_HEADER =0x300+6,
|
||||
OPS_PTAG_CT_SIGNED_CLEARTEXT_BODY =0x300+7,
|
||||
OPS_PTAG_CT_SIGNED_CLEARTEXT_TRAILER=0x300+8,
|
||||
OPS_PTAG_CT_UNARMOURED_TEXT =0x300+9,
|
||||
OPS_PTAG_CT_ENCRYPTED_SECRET_KEY =0x300+10, // In this case the algorithm specific fields will not be initialised
|
||||
OPS_PTAG_CT_SE_DATA_HEADER =0x300+11,
|
||||
OPS_PTAG_CT_SE_DATA_BODY =0x300+12,
|
||||
OPS_PTAG_CT_SE_IP_DATA_HEADER =0x300+13,
|
||||
OPS_PTAG_CT_SE_IP_DATA_BODY =0x300+14,
|
||||
OPS_PTAG_CT_ENCRYPTED_PK_SESSION_KEY=0x300+15,
|
||||
|
||||
/* commands to the callback */
|
||||
OPS_PARSER_CMD_GET_SK_PASSPHRASE =0x400,
|
||||
OPS_PARSER_CMD_GET_SECRET_KEY =0x400+1,
|
||||
|
||||
|
||||
/* Errors */
|
||||
OPS_PARSER_ERROR =0x500, /*!< Internal Use: Parser Error */
|
||||
OPS_PARSER_ERRCODE =0x500+1, /*! < Internal Use: Parser Error with errcode returned */
|
||||
};
|
||||
|
||||
/** Used to specify whether subpackets should be returned raw, parsed or ignored.
|
||||
*/
|
||||
|
||||
enum ops_parse_type_t
|
||||
{
|
||||
OPS_PARSE_RAW, /*!< Callback Raw */
|
||||
OPS_PARSE_PARSED, /*!< Callback Parsed */
|
||||
OPS_PARSE_IGNORE, /*!< Don't callback */
|
||||
};
|
||||
|
||||
typedef struct _ops_crypt_t ops_crypt_t;
|
||||
|
||||
@ -85,7 +205,7 @@ typedef enum
|
||||
OPS_WF_DUMMY,
|
||||
} ops_writer_flags_t;
|
||||
/** ops_writer_ret_t */
|
||||
typedef enum ops_writer_ret_t ops_writer_ret_t;
|
||||
/* typedef enum ops_writer_ret_t ops_writer_ret_t; */
|
||||
|
||||
/**
|
||||
* \ingroup Create
|
||||
|
Loading…
Reference in New Issue
Block a user