mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 16:39:43 -05:00
fixed test programs for openpgp
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-OpenPGP@5253 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
9357a228a6
commit
e9018f80b8
29
libretroshare/src/tests/pgp/Makefile
Normal file
29
libretroshare/src/tests/pgp/Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
RS_TOP_DIR = ../..
|
||||
DHT_TOP_DIR = ../../../../libbitdht/src
|
||||
OPENPGP_INCLUDE_DIR = ../../../../openpgpsdk/include
|
||||
|
||||
##### Define any flags that are needed for this section #######
|
||||
###############################################################
|
||||
|
||||
###############################################################
|
||||
include $(RS_TOP_DIR)/tests/scripts/config.mk
|
||||
###############################################################
|
||||
|
||||
TESTOBJ = test_pgp_handler.o test_pgp_signature_parsing.o
|
||||
TESTS = test_pgp_handler test_pgp_signature_parsing
|
||||
|
||||
#rsbaseitem_test
|
||||
|
||||
all: tests
|
||||
|
||||
test_pgp_handler : test_pgp_handler.o
|
||||
$(CC) $(CFLAGS) -o test_pgp_handler test_pgp_handler.o $(OBJ) $(LIBS) -L../../../../openpgpsdk/lib/ -lops -lbz2
|
||||
|
||||
test_pgp_signature_parsing : test_pgp_signature_parsing.o
|
||||
$(CC) $(CFLAGS) -o test_pgp_signature_parsing test_pgp_signature_parsing.o $(OBJ) $(LIBS) -L../../../../openpgpsdk/lib/ -lops -lbz2
|
||||
|
||||
###############################################################
|
||||
include $(RS_TOP_DIR)/scripts/rules.mk
|
||||
###############################################################
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include "pgphandler.h"
|
||||
#include <pgp/pgphandler.h>
|
||||
|
||||
static std::string passphrase_callback(void *data,const char *uid_info,const char *what,int prev_was_bad)
|
||||
{
|
||||
@ -39,12 +39,14 @@ int main(int argc,char *argv[])
|
||||
|
||||
static const std::string pubring = "pubring.gpg" ;
|
||||
static const std::string secring = "secring.gpg" ;
|
||||
static const std::string trustdb = "trustdb.gpg" ;
|
||||
static const std::string lockfile = "lock" ;
|
||||
|
||||
PGPHandler::setPassphraseCallback(&passphrase_callback) ;
|
||||
PGPHandler pgph(pubring,secring) ;
|
||||
PGPHandler pgph(pubring,secring,trustdb,lockfile) ;
|
||||
|
||||
std::cerr << "Writing public keyring to file tmp_keyring.asc" << std::endl;
|
||||
pgph.writePublicKeyring("tmp_keyring.asc") ;
|
||||
// std::cerr << "Writing public keyring to file tmp_keyring.asc" << std::endl;
|
||||
// pgph.writePublicKeyring("tmp_keyring.asc") ;
|
||||
|
||||
pgph.printKeys() ;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include "pgphandler.h"
|
||||
#include <pgp/pgphandler.h>
|
||||
|
||||
static std::string passphrase_callback(void *data,const char *uid_info,const char *what,int prev_was_bad)
|
||||
{
|
||||
@ -28,20 +28,21 @@ int main(int argc,char *argv[])
|
||||
{
|
||||
// test pgp ids.
|
||||
//
|
||||
PGPIdType id = PGPIdType::fromUserId_hex("3e5b22140ef56abb") ;
|
||||
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 = "globo.gpg" ;
|
||||
static const std::string secring = "globo.gpg" ;
|
||||
static const std::string pubring = "pubring.gpg" ;
|
||||
static const std::string secring = "secring.gpg" ;
|
||||
static const std::string trustdb = "trustdb.gpg" ;
|
||||
static const std::string lockfil = "lock" ;
|
||||
|
||||
PGPHandler::setPassphraseCallback(&passphrase_callback) ;
|
||||
PGPHandler pgph(pubring,secring) ;
|
||||
PGPHandler pgph(pubring,secring,trustdb,lockfil) ;
|
||||
|
||||
pgph.printKeys() ;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ BITDIR = $(DHT_TOP_DIR)/lib
|
||||
LIBRS = $(LIBDIR)/libretroshare.a
|
||||
BITDHT = $(BITDIR)/libbitdht.a
|
||||
# Unix: Linux/Cygwin
|
||||
INCLUDE = -I $(RS_TOP_DIR)
|
||||
INCLUDE = -I $(RS_TOP_DIR) -I$(OPENPGP_INCLUDE_DIR)
|
||||
CFLAGS = -Wall -g $(INCLUDE)
|
||||
#CFLAGS += -fprofile-arcs -ftest-coverage
|
||||
CFLAGS += ${DEFINES}
|
||||
|
Loading…
Reference in New Issue
Block a user