📄 testin
字号:
/*____________________________________________________________________________
Copyright (C) 1997 Pretty Good Privacy, Inc.
All rights reserved.
$Id: testin,v 1.1 2001/07/20 00:31:38 hal Exp $
____________________________________________________________________________*/
#include "pgpConfig.h"
#include <stdio.h>
#include "pgpEncode.h"
#include "pgpErrors.h"
#include "pgpTest.h"
#include "pgpUtilities.h"
/*____________________________________________________________________________
This code requires that a test file called "testin" exists in your
current directory.
____________________________________________________________________________*/
static void
TestEncodeCanned( PGPContextRef context )
{
printf( "TestEncodeCanned...\n" );
/* dump all the keys */
TestEncodeCmdLine( context, "-l" );
/* conventionally encrypt/decrypt the file */
TestEncodeCmdLine( context, "-i force -c test testin testconv" );
TestEncodeCmdLine( context,
"-i auto -z test -d testconv testconvclr" );
/* conventionally encrypt/decrypt the file with ascii armor*/
TestEncodeCmdLine( context, "-a -i force -c test testin testconva" );
TestEncodeCmdLine( context,
"-i auto -z test -d testconva testconvclr" );
/* encrypt known input file to output */
/* decrypt output file to cleartext temp */
TestEncodeCmdLine( context,
"-i force -e <test@pgp.com> testin testcrpt" );
TestEncodeCmdLine( context,
"-i auto -z test -d testcrpt testclr" );
/* same as above, but with ascii armor */
TestEncodeCmdLine( context,
"-i force -e <test@pgp.com> testin testcrpta" );
TestEncodeCmdLine( context,
"-i auto -z test -d testcrpta testclr" );
/* sign file */
TestEncodeCmdLine( context,
"-i force -s <test@pgp.com> -z test testin testsigned" );
TestEncodeCmdLine( context,
"-i auto -d testsigned testclr" );
/* same as above, but with ascii armor */
TestEncodeCmdLine( context,
"-a -i force -s <test@pgp.com> -z test testin testsigneda" );
TestEncodeCmdLine( context,
"-i auto -d testsigneda testclr" );
/* sign file with detached sig */
TestEncodeCmdLine( context,
"-i force -s <test@pgp.com> -z test -b testin testin.sig" );
TestEncodeCmdLine( context,
"-i auto -v testin.sig testin" );
}
void
TestMain()
{
PGPContextRef context = NULL;
PGPError err = kPGPError_NoErr;
printf( "beginning tests...\n" );
err = PGPNewContext( &context );
if ( IsntPGPError( err ) )
{
printf( "TestSymmetricCipher...\n" );
TestSymmetricCipher( context );
printf( "TestCipherFeedback...\n" );
TestCipherFeedback( context );
printf( "TestHash...\n" );
TestHash( context );
printf( "TestKeys...\n" );
TestKeys( context );
TestEncodeCanned( context);
(void)PGPFreeContext( context );
}
printf( "done with tests.\n" );
}
void
_pgpTestAssert(
PGPBoolean condition,
const char * expr )
{
if ( ! condition )
{
fprintf( stderr, "ASSERTION FAILED: %s\n", expr );
}
}
void
pgpTestDebugMsg( const char *msg )
{
fprintf( stderr, "%s\n", msg );
}
void
PGPDebugMessage( const char *message )
{
_pgpTestAssert( FALSE, message );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -