summaryrefslogtreecommitdiffstats
path: root/libkpgp/kpgpbase2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkpgp/kpgpbase2.cpp')
-rw-r--r--libkpgp/kpgpbase2.cpp196
1 files changed, 98 insertions, 98 deletions
diff --git a/libkpgp/kpgpbase2.cpp b/libkpgp/kpgpbase2.cpp
index 06c0d1e6..da003881 100644
--- a/libkpgp/kpgpbase2.cpp
+++ b/libkpgp/kpgpbase2.cpp
@@ -66,7 +66,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
const char *passphrase )
{
TQCString cmd;
- int exiStatus = 0;
+ int exitqStatus = 0;
if(!recipients.isEmpty() && passphrase != 0)
cmd = PGP2 " +batchmode +language=en +verbose=1 -seat";
@@ -100,12 +100,12 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
clear();
input = block.text();
- exiStatus = run(cmd.data(), passphrase);
+ exitqStatus = run(cmd.data(), passphrase);
if( !output.isEmpty() )
block.setProcessedText( output );
block.setError( error );
- if(exiStatus != 0)
+ if(exitqStatus != 0)
status = ERROR;
#if 0
@@ -118,16 +118,16 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
bool bad = FALSE;
unsigned int num = 0;
TQCString badkeys = "";
- if (error.find("Cannot find the public key") != -1)
+ if (error.tqfind("Cannot find the public key") != -1)
{
index = 0;
num = 0;
- while((index = error.find("Cannot find the public key",index))
+ while((index = error.tqfind("Cannot find the public key",index))
!= -1)
{
bad = TRUE;
- index = error.find('\'',index);
- int index2 = error.find('\'',index+1);
+ index = error.tqfind('\'',index);
+ int index2 = error.tqfind('\'',index+1);
if (num++)
badkeys += ", ";
badkeys += error.mid(index, index2-index+1);
@@ -149,15 +149,15 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
status |= ERROR;
}
}
- if (error.find("skipping userid") != -1)
+ if (error.tqfind("skipping userid") != -1)
{
index = 0;
num = 0;
- while((index = error.find("skipping userid",index))
+ while((index = error.tqfind("skipping userid",index))
!= -1)
{
bad = TRUE;
- int index2 = error.find('\n',index+16);
+ int index2 = error.tqfind('\n',index+16);
if (num++)
badkeys += ", ";
badkeys += error.mid(index+16, index2-index-16);
@@ -187,12 +187,12 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
#endif
if(passphrase != 0)
{
- if(error.find("Pass phrase is good") != -1)
+ if(error.tqfind("Pass phrase is good") != -1)
{
//kdDebug(5100) << "Base: Good Passphrase!" << endl;
status |= SIGNED;
}
- if( error.find("Bad pass phrase") != -1)
+ if( error.tqfind("Bad pass phrase") != -1)
{
errMsg = i18n("Bad passphrase; could not sign.");
status |= BADPHRASE;
@@ -200,7 +200,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
status |= ERROR;
}
}
- if (error.find("Signature error") != -1)
+ if (error.tqfind("Signature error") != -1)
{
errMsg = i18n("Signing failed: please check your PGP User Identity, "
"the PGP setup, and the key rings.");
@@ -208,7 +208,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
status |= ERR_SIGNING;
status |= ERROR;
}
- if (error.find("Encryption error") != -1)
+ if (error.tqfind("Encryption error") != -1)
{
errMsg = i18n("Encryption failed: please check your PGP setup "
"and the key rings.");
@@ -218,7 +218,7 @@ Base2::encsign( Block& block, const KeyIDList& recipients,
}
//kdDebug(5100) << "status = " << status << endl;
- block.seStatus( status );
+ block.setqStatus( status );
return status;
}
@@ -227,38 +227,38 @@ int
Base2::decrypt( Block& block, const char *passphrase )
{
int index, index2;
- int exiStatus = 0;
+ int exitqStatus = 0;
clear();
input = block.text();
- exiStatus = run(PGP2 " +batchmode +language=en -f", passphrase);
+ exitqStatus = run(PGP2 " +batchmode +language=en -f", passphrase);
if( !output.isEmpty() )
block.setProcessedText( output );
block.setError( error );
// pgp2.6 has sometimes problems with the ascii armor pgp5.0 produces
// this hack can solve parts of the problem
- if(error.find("ASCII armor corrupted.") != -1)
+ if(error.tqfind("ASCII armor corrupted.") != -1)
{
kdDebug(5100) << "removing ASCII armor header" << endl;
- int index1 = input.find("-----BEGIN PGP SIGNED MESSAGE-----");
+ int index1 = input.tqfind("-----BEGIN PGP SIGNED MESSAGE-----");
if(index1 != -1)
- index1 = input.find("-----BEGIN PGP SIGNATURE-----", index1);
+ index1 = input.tqfind("-----BEGIN PGP SIGNATURE-----", index1);
else
- index1 = input.find("-----BEGIN PGP MESSAGE-----");
- index1 = input.find('\n', index1);
- index2 = input.find("\n\n", index1);
+ index1 = input.tqfind("-----BEGIN PGP MESSAGE-----");
+ index1 = input.tqfind('\n', index1);
+ index2 = input.tqfind("\n\n", index1);
input.remove(index1, index2 - index1);
- exiStatus = run(PGP2 " +batchmode +language=en -f", passphrase);
+ exitqStatus = run(PGP2 " +batchmode +language=en -f", passphrase);
if( !output.isEmpty() )
block.setProcessedText( output );
block.setError( error );
}
- if(exiStatus == -1) {
+ if(exitqStatus == -1) {
errMsg = i18n("error running PGP");
status = RUN_ERR;
- block.seStatus( status );
+ block.setqStatus( status );
return status;
}
@@ -282,19 +282,19 @@ Base2::decrypt( Block& block, const char *passphrase )
*
* You do not have the secret key needed to decrypt this file.
*/
- if(error.find("File is encrypted.") != -1)
+ if(error.tqfind("File is encrypted.") != -1)
{
//kdDebug(5100) << "kpgpbase: message is encrypted" << endl;
status |= ENCRYPTED;
- if((index = error.find("Key for user ID:")) != -1)
+ if((index = error.tqfind("Key for user ID:")) != -1)
{
// Find out the key for which the phrase is needed
index += 17;
- index2 = error.find('\n', index);
+ index2 = error.tqfind('\n', index);
block.setRequiredUserId( error.mid(index, index2 - index) );
//kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!\n";
- if((passphrase != 0) && (error.find("Bad pass phrase") != -1))
+ if((passphrase != 0) && (error.tqfind("Bad pass phrase") != -1))
{
errMsg = i18n("Bad passphrase; could not decrypt.");
kdDebug(5100) << "Base: passphrase is bad" << endl;
@@ -314,14 +314,14 @@ Base2::decrypt( Block& block, const char *passphrase )
#if 0
// ##### FIXME: This information is anyway currently not used
// I'll change it to always determine the recipients.
- index = error.find("can only be read by:");
+ index = error.tqfind("can only be read by:");
if(index != -1)
{
- index = error.find('\n',index);
- int end = error.find("\n\n",index);
+ index = error.tqfind('\n',index);
+ int end = error.tqfind("\n\n",index);
mRecipients.clear();
- while( (index2 = error.find('\n',index+1)) <= end )
+ while( (index2 = error.tqfind('\n',index+1)) <= end )
{
TQCString item = error.mid(index+1,index2-index-1);
item.stripWhiteSpace();
@@ -392,19 +392,19 @@ Base2::decrypt( Block& block, const char *passphrase )
* Signature made 2001/09/09 16:01 GMT using 1024-bit key, key ID 12345678
*/
- if((index = error.find("File has signature")) != -1)
+ if((index = error.tqfind("File has signature")) != -1)
{
// move index to start of next line
- index = error.find('\n', index+18) + 1;
+ index = error.tqfind('\n', index+18) + 1;
//kdDebug(5100) << "Base: message is signed" << endl;
status |= SIGNED;
// get signature date and signature key ID
- if ((index2 = error.find("Signature made", index)) != -1) {
+ if ((index2 = error.tqfind("Signature made", index)) != -1) {
index2 += 15;
- int index3 = error.find("using", index2);
+ int index3 = error.tqfind("using", index2);
block.setSignatureDate( error.mid(index2, index3-index2-1) );
kdDebug(5100) << "Message was signed on '" << block.signatureDate() << "'\n";
- index3 = error.find("key ID ", index3) + 7;
+ index3 = error.tqfind("key ID ", index3) + 7;
block.setSignatureKeyId( error.mid(index3,8) );
kdDebug(5100) << "Message was signed with key '" << block.signatureKeyId() << "'\n";
}
@@ -415,38 +415,38 @@ Base2::decrypt( Block& block, const char *passphrase )
block.setSignatureKeyId( "" );
}
- if( ( index2 = error.find("Key matching expected", index) ) != -1)
+ if( ( index2 = error.tqfind("Key matching expected", index) ) != -1)
{
status |= UNKNOWN_SIG;
status |= GOODSIG;
- int index3 = error.find("Key ID ", index2) + 7;
+ int index3 = error.tqfind("Key ID ", index2) + 7;
block.setSignatureKeyId( error.mid(index3,8) );
- block.setSignatureUserId( TQString::null );
+ block.setSignatureUserId( TQString() );
}
- else if( (index2 = error.find("Good signature from", index)) != -1 )
+ else if( (index2 = error.tqfind("Good signature from", index)) != -1 )
{
status |= GOODSIG;
// get signer
- index = error.find('"',index2+19);
- index2 = error.find('"', index+1);
+ index = error.tqfind('"',index2+19);
+ index2 = error.tqfind('"', index+1);
block.setSignatureUserId( error.mid(index+1, index2-index-1) );
}
- else if( (index2 = error.find("Bad signature from", index)) != -1 )
+ else if( (index2 = error.tqfind("Bad signature from", index)) != -1 )
{
status |= ERROR;
// get signer
- index = error.find('"',index2+19);
- index2 = error.find('"', index+1);
+ index = error.tqfind('"',index2+19);
+ index2 = error.tqfind('"', index+1);
block.setSignatureUserId( error.mid(index+1, index2-index-1) );
}
- else if( error.find("Keyring file", index) != -1 )
+ else if( error.tqfind("Keyring file", index) != -1 )
{
// #### fix this hack
status |= UNKNOWN_SIG;
status |= GOODSIG; // this is a hack...
// determine file name of missing keyring file
- index = error.find('\'', index) + 1;
- index2 = error.find('\'', index);
+ index = error.tqfind('\'', index) + 1;
+ index2 = error.tqfind('\'', index);
block.setSignatureUserId( i18n("The keyring file %1 does not exist.\n"
"Please check your PGP setup.").arg(error.mid(index, index2-index)) );
}
@@ -457,7 +457,7 @@ Base2::decrypt( Block& block, const char *passphrase )
}
}
//kdDebug(5100) << "status = " << status << endl;
- block.seStatus( status );
+ block.setqStatus( status );
return status;
}
@@ -467,13 +467,13 @@ Base2::readPublicKey( const KeyID& keyID,
const bool readTrust /* = false */,
Key* key /* = 0 */ )
{
- int exiStatus = 0;
+ int exitqStatus = 0;
status = 0;
- exiStatus = run( PGP2 " +batchmode +language=en +verbose=0 -kvc -f 0x" +
+ exitqStatus = run( PGP2 " +batchmode +language=en +verbose=0 -kvc -f 0x" +
keyID, 0, true );
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return 0;
}
@@ -487,10 +487,10 @@ Base2::readPublicKey( const KeyID& keyID,
if( readTrust )
{
- exiStatus = run( PGP2 " +batchmode +language=en +verbose=0 -kc -f",
+ exitqStatus = run( PGP2 " +batchmode +language=en +verbose=0 -kc -f",
0, true );
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return 0;
}
@@ -512,14 +512,14 @@ Base2::publicKeys( const TQStringList & patterns )
KeyList
Base2::doGetPublicKeys( const TQCString & cmd, const TQStringList & patterns )
{
- int exiStatus = 0;
+ int exitqStatus = 0;
KeyList publicKeys;
status = 0;
if ( patterns.isEmpty() ) {
- exiStatus = run( cmd, 0, true );
+ exitqStatus = run( cmd, 0, true );
- if ( exiStatus != 0 ) {
+ if ( exitqStatus != 0 ) {
status = ERROR;
return KeyList();
}
@@ -533,10 +533,10 @@ Base2::doGetPublicKeys( const TQCString & cmd, const TQStringList & patterns )
for ( TQStringList::ConstIterator it = patterns.begin();
it != patterns.end(); ++it ) {
- exiStatus = run( cmd + " " + KProcess::quote( *it ).local8Bit(),
+ exitqStatus = run( cmd + " " + KProcess::quote( *it ).local8Bit(),
0, true );
- if ( exiStatus != 0 ) {
+ if ( exitqStatus != 0 ) {
status = ERROR;
return KeyList();
}
@@ -576,16 +576,16 @@ int
Base2::signKey(const KeyID& keyID, const char *passphrase)
{
TQCString cmd;
- int exiStatus = 0;
+ int exitqStatus = 0;
cmd = PGP2 " +batchmode +language=en -ks -f ";
cmd += addUserId();
cmd += " 0x" + keyID;
status = 0;
- exiStatus = run(cmd.data(),passphrase);
+ exitqStatus = run(cmd.data(),passphrase);
- if (exiStatus != 0)
+ if (exitqStatus != 0)
status = ERROR;
return status;
@@ -594,16 +594,16 @@ Base2::signKey(const KeyID& keyID, const char *passphrase)
TQCString Base2::getAsciiPublicKey(const KeyID& keyID)
{
- int exiStatus = 0;
+ int exitqStatus = 0;
if (keyID.isEmpty())
return TQCString();
status = 0;
- exiStatus = run( PGP2 " +batchmode +force +language=en -kxaf 0x" + keyID,
+ exitqStatus = run( PGP2 " +batchmode +force +language=en -kxaf 0x" + keyID,
0, true );
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return TQCString();
}
@@ -626,10 +626,10 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ )
{
/*
if( secretKeys )
- index = output.find( "\nsec" );
+ index = output.tqfind( "\nsec" );
else
*/
- index = output.find( "\npub" );
+ index = output.tqfind( "\npub" );
if( index == -1 )
return 0;
else
@@ -641,12 +641,12 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ )
int index2;
// search the end of the current line
- if( ( index2 = output.find( '\n', index ) ) == -1 )
+ if( ( index2 = output.tqfind( '\n', index ) ) == -1 )
break;
if( !strncmp( output.data() + index, "pub", 3 ) ||
!strncmp( output.data() + index, "sec", 3 ) )
- { // line tqcontains primary key data
+ { // line contains primary key data
// Example 1 (nothing special):
// pub 1024/E2D074D3 2001/09/09 Test Key <testkey@xyz>
// Example 2 (disabled key):
@@ -699,25 +699,25 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ )
pos = index + 4;
while( output[pos] == ' ' )
pos++;
- pos2 = output.find( '/', pos );
+ pos2 = output.tqfind( '/', pos );
subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() );
// Key ID
pos = pos2 + 1;
- pos2 = output.find( ' ', pos );
+ pos2 = output.tqfind( ' ', pos );
subkey->setKeyID( output.mid( pos, pos2-pos ) );
// Creation Date
pos = pos2 + 1;
while( output[pos] == ' ' )
pos++;
- pos2 = output.find( ' ', pos );
+ pos2 = output.tqfind( ' ', pos );
int year = output.mid( pos, 4 ).toInt();
int month = output.mid( pos+5, 2 ).toInt();
int day = output.mid( pos+8, 2 ).toInt();
TQDateTime dt( TQDate( year, month, day ), TQTime( 00, 00 ) );
TQDateTime epoch( TQDate( 1970, 01, 01 ), TQTime( 00, 00 ) );
- // The calculated creation date isn't exactly correct because QDateTime
+ // The calculated creation date isn't exactly correct because TQDateTime
// doesn't know anything about timezones and always assumes local time
// although epoch is of course UTC. But as PGP 2 anyway doesn't print
// the time this doesn't matter too much.
@@ -737,7 +737,7 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ )
}
}
else if( output[index] == ' ' )
- { // line tqcontains additional key data
+ { // line contains additional key data
if( key == 0 )
break;
@@ -748,20 +748,20 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ )
pos++;
if( !strncmp( output.data() + pos, "Key fingerprint = ", 18 ) )
- { // line tqcontains a fingerprint
+ { // line contains a fingerprint
// Example:
// Key fingerprint = 47 30 7C 76 05 BF 5E FB 72 41 00 F2 7D 0B D0 49
TQCString fingerprint = output.mid( pos, index2-pos );
// remove white space from the fingerprint
- for ( int idx = 0 ; (idx = fingerprint.find(' ', idx)) >= 0 ; )
+ for ( int idx = 0 ; (idx = fingerprint.tqfind(' ', idx)) >= 0 ; )
fingerprint.tqreplace( idx, 1, "" );
subkey->setFingerprint( fingerprint );
}
else if( !strncmp( output.data() + pos, "Expire: ", 8 ) ||
!strncmp( output.data() + pos, "no expire ", 10 ) )
- { // line tqcontains additional key properties
+ { // line contains additional key properties
// Examples:
// Expire: 2001/09/10
// no expire ENCRyption only
@@ -801,7 +801,7 @@ Base2::parsePublicKeyData( const TQCString& output, Key* key /* = 0 */ )
}
}
else
- { // line tqcontains an additional user id
+ { // line contains an additional user id
// Example:
// Test key (2nd user ID) <abc@xyz>
@@ -827,10 +827,10 @@ Base2::parseTrustDataForKey( Key* key, const TQCString& str )
UserIDList userIDs = key->userIDs();
// search the trust data belonging to this key
- int index = str.find( '\n' ) + 1;
+ int index = str.tqfind( '\n' ) + 1;
while( ( index > 0 ) &&
( strncmp( str.data() + index+2, keyID.data(), 8 ) != 0 ) )
- index = str.find( '\n', index ) + 1;
+ index = str.tqfind( '\n', index ) + 1;
if( index == 0 )
return;
@@ -846,7 +846,7 @@ Base2::parseTrustDataForKey( Key* key, const TQCString& str )
int index2;
// search the end of the current line
- if( ( index2 = str.find( '\n', index ) ) == -1 )
+ if( ( index2 = str.tqfind( '\n', index ) ) == -1 )
break;
// check if trust info for the next key starts
@@ -854,7 +854,7 @@ Base2::parseTrustDataForKey( Key* key, const TQCString& str )
break;
if( str[index+21] != ' ' )
- { // line tqcontains a validity value for a user ID
+ { // line contains a validity value for a user ID
// determine the validity
Validity validity = KPGP_VALIDITY_UNKNOWN;
@@ -908,9 +908,9 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys )
else
{
if( secretKeys )
- index = output.find( "\nsec" );
+ index = output.tqfind( "\nsec" );
else
- index = output.find( "\npub" );
+ index = output.tqfind( "\npub" );
if( index == -1 )
return keys;
else
@@ -922,12 +922,12 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys )
int index2;
// search the end of the current line
- if( ( index2 = output.find( '\n', index ) ) == -1 )
+ if( ( index2 = output.tqfind( '\n', index ) ) == -1 )
break;
if( !strncmp( output.data() + index, "pub", 3 ) ||
!strncmp( output.data() + index, "sec", 3 ) )
- { // line tqcontains primary key data
+ { // line contains primary key data
// Example 1:
// pub 1024/E2D074D3 2001/09/09 Test Key <testkey@xyz>
// Example 2 (disabled key):
@@ -979,25 +979,25 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys )
pos = index + 4;
while( output[pos] == ' ' )
pos++;
- pos2 = output.find( '/', pos );
+ pos2 = output.tqfind( '/', pos );
subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() );
// Key ID
pos = pos2 + 1;
- pos2 = output.find( ' ', pos );
+ pos2 = output.tqfind( ' ', pos );
subkey->setKeyID( output.mid( pos, pos2-pos ) );
// Creation Date
pos = pos2 + 1;
while( output[pos] == ' ' )
pos++;
- pos2 = output.find( ' ', pos );
+ pos2 = output.tqfind( ' ', pos );
int year = output.mid( pos, 4 ).toInt();
int month = output.mid( pos+5, 2 ).toInt();
int day = output.mid( pos+8, 2 ).toInt();
TQDateTime dt( TQDate( year, month, day ), TQTime( 00, 00 ) );
TQDateTime epoch( TQDate( 1970, 01, 01 ), TQTime( 00, 00 ) );
- // The calculated creation date isn't exactly correct because QDateTime
+ // The calculated creation date isn't exactly correct because TQDateTime
// doesn't know anything about timezones and always assumes local time
// although epoch is of course UTC. But as PGP 2 anyway doesn't print
// the time this doesn't matter too much.
@@ -1017,7 +1017,7 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys )
}
}
else if( output[index] == ' ' )
- { // line tqcontains additional key data
+ { // line contains additional key data
if( key == 0 )
break;
@@ -1027,7 +1027,7 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys )
pos++;
if( !strncmp( output.data() + pos, "Key fingerprint = ", 18 ) )
- { // line tqcontains a fingerprint
+ { // line contains a fingerprint
// Example:
// Key fingerprint = 47 30 7C 76 05 BF 5E FB 72 41 00 F2 7D 0B D0 49
@@ -1035,14 +1035,14 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys )
pos2 = pos + 18;
TQCString fingerprint = output.mid( pos, index2-pos );
// remove white space from the fingerprint
- for ( int idx = 0 ; (idx = fingerprint.find(' ', idx)) >= 0 ; )
+ for ( int idx = 0 ; (idx = fingerprint.tqfind(' ', idx)) >= 0 ; )
fingerprint.tqreplace( idx, 1, "" );
subkey->setFingerprint( fingerprint );
}
else if( !strncmp( output.data() + pos, "Expire: ", 8 ) ||
!strncmp( output.data() + pos, "no expire ", 10 ) )
- { // line tqcontains additional key properties
+ { // line contains additional key properties
// Examples:
// Expire: 2001/09/10
// no expire ENCRyption only
@@ -1082,7 +1082,7 @@ Base2::parseKeyList( const TQCString& output, bool secretKeys )
}
}
else
- { // line tqcontains an additional user id
+ { // line contains an additional user id
// Example:
// Test key (2nd user ID) <abc@xyz>