summaryrefslogtreecommitdiffstats
path: root/libkpgp/kpgpbase6.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkpgp/kpgpbase6.cpp')
-rw-r--r--libkpgp/kpgpbase6.cpp148
1 files changed, 74 insertions, 74 deletions
diff --git a/libkpgp/kpgpbase6.cpp b/libkpgp/kpgpbase6.cpp
index fba6d4ec7..440ac6e20 100644
--- a/libkpgp/kpgpbase6.cpp
+++ b/libkpgp/kpgpbase6.cpp
@@ -49,32 +49,32 @@ int
Base6::decrypt( Block& block, const char *passphrase )
{
int index, index2;
- int exiStatus = 0;
+ int exitqStatus = 0;
clear();
input = block.text();
- exiStatus = run( PGP6 " +batchmode +language=C -f", passphrase);
+ exitqStatus = run( PGP6 " +batchmode +language=C -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;
}
// encrypted message
- 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 = error.find(':', index) + 2;
- index2 = error.find('\n', index);
+ index = error.tqfind(':', index) + 2;
+ index2 = error.tqfind('\n', index);
block.setRequiredUserId( error.mid(index, index2 - index) );
//kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!\n";
@@ -90,7 +90,7 @@ Base6::decrypt( Block& block, const char *passphrase )
status |= ERROR;
}
}
- else if( error.find("You do not have the secret key needed to decrypt this file.") != -1)
+ else if( error.tqfind("You do not have the secret key needed to decrypt this file.") != -1)
{
errMsg = i18n("You do not have the secret key for this message.");
//kdDebug(5100) << "Base: no secret key for this message" << endl;
@@ -123,46 +123,46 @@ Base6::decrypt( Block& block, const char *passphrase )
* File is signed. Good signature from user "Joe User <joe@foo.bar>".
* Signature made 2001/12/05 13:09 GMT
*/
- if(((index = error.find("File is signed.")) != -1)
- || (error.find("Good signature") != -1 ))
+ if(((index = error.tqfind("File is signed.")) != -1)
+ || (error.tqfind("Good signature") != -1 ))
{
//kdDebug(5100) << "Base: message is signed" << endl;
status |= SIGNED;
// determine the signature date
- if( ( index2 = error.find( "Signature made", index ) ) != -1 )
+ if( ( index2 = error.tqfind( "Signature made", index ) ) != -1 )
{
index2 += 15;
- int eol = error.find( '\n', index2 );
+ int eol = error.tqfind( '\n', index2 );
block.setSignatureDate( error.mid( index2, eol-index2 ) );
kdDebug(5100) << "Message was signed on '" << block.signatureDate() << "'\n";
}
else
block.setSignatureDate( TQCString() );
// determine signature status and signature key
- if( error.find("signature not checked") != -1)
+ if( error.tqfind("signature not checked") != -1)
{
- index = error.find("KeyID:",index);
+ index = error.tqfind("KeyID:",index);
block.setSignatureKeyId( error.mid(index+9,8) );
- block.setSignatureUserId( TQString::null );
+ block.setSignatureUserId( TQString() );
status |= UNKNOWN_SIG;
status |= GOODSIG;
}
- else if((index = error.find("Good signature")) != -1 )
+ else if((index = error.tqfind("Good signature")) != -1 )
{
status |= GOODSIG;
// get signer
- index = error.find('"',index)+1;
- index2 = error.find('"', index);
+ index = error.tqfind('"',index)+1;
+ index2 = error.tqfind('"', index);
block.setSignatureUserId( error.mid(index, index2-index) );
// get key ID of signer
- index = error.find("KeyID:",index2);
+ index = error.tqfind("KeyID:",index2);
if (index == -1)
block.setSignatureKeyId( TQCString() );
else
block.setSignatureKeyId( error.mid(index+9,8) );
}
- else if( error.find("Can't find the right public key") != -1 )
+ else if( error.tqfind("Can't find the right public key") != -1 )
{
// #### fix this hack
// #### This doesn't happen with PGP 6.5.8 because it seems to
@@ -175,12 +175,12 @@ Base6::decrypt( Block& block, const char *passphrase )
else
{
status |= ERROR;
- block.setSignatureUserId( TQString::null );
+ block.setSignatureUserId( TQString() );
block.setSignatureKeyId( TQCString() );
}
}
//kdDebug(5100) << "status = " << status << endl;
- block.seStatus( status );
+ block.setqStatus( status );
return status;
}
@@ -190,13 +190,13 @@ Base6::readPublicKey( const KeyID& keyID,
const bool readTrust /* = false */,
Key* key /* = 0 */ )
{
- int exiStatus = 0;
+ int exitqStatus = 0;
status = 0;
- exiStatus = run( PGP6 " +batchmode -compatible +verbose=0 +language=C -kvvc "
+ exitqStatus = run( PGP6 " +batchmode -compatible +verbose=0 +language=C -kvvc "
"0x" + keyID, 0, true );
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return 0;
}
@@ -210,10 +210,10 @@ Base6::readPublicKey( const KeyID& keyID,
if( readTrust )
{
- exiStatus = run( PGP6 " +batchmode -compatible +verbose=0 +language=C -kc "
+ exitqStatus = run( PGP6 " +batchmode -compatible +verbose=0 +language=C -kc "
"0x" + keyID, 0, true );
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return 0;
}
@@ -234,17 +234,17 @@ Base6::publicKeys( const TQStringList & patterns )
/*
-QStrList
+TQStrList
Base6::pubKeys()
{
int index, index2;
- int exiStatus = 0;
+ int exitqStatus = 0;
int compatibleMode = 1;
status = 0;
- exiStatus = run("pgp +batchmode +language=C -kv -f");
+ exitqStatus = run("pgp +batchmode +language=C -kv -f");
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return 0;
}
@@ -253,28 +253,28 @@ Base6::pubKeys()
if (error.length() > 1) error.truncate(error.length()-1);
TQStrList publicKeys;
- index = error.find("bits/keyID",1); // skip first to "\n"
+ index = error.tqfind("bits/keyID",1); // skip first to "\n"
if (index ==-1)
{
- index = error.find("Type bits",1); // skip first to "\n"
+ index = error.tqfind("Type bits",1); // skip first to "\n"
if (index == -1)
return 0;
else
compatibleMode = 0;
}
- while( (index = error.find("\n",index)) != -1)
+ while( (index = error.tqfind("\n",index)) != -1)
{
//parse line
TQCString line;
- if( (index2 = error.find("\n",index+1)) != -1)
+ if( (index2 = error.tqfind("\n",index+1)) != -1)
// skip last line
{
int index3;
if (compatibleMode)
{
- int index_pub = error.find("pub ",index);
- int index_sec = error.find("sec ",index);
+ int index_pub = error.tqfind("pub ",index);
+ int index_sec = error.tqfind("sec ",index);
if (index_pub < 0)
index3 = index_sec;
else if (index_sec < 0)
@@ -284,8 +284,8 @@ Base6::pubKeys()
}
else
{
- int index_rsa = error.find("RSA ",index);
- int index_dss = error.find("DSS ",index);
+ int index_rsa = error.tqfind("RSA ",index);
+ int index_dss = error.tqfind("DSS ",index);
if (index_rsa < 0)
index3 = index_dss;
else if (index_dss < 0)
@@ -301,14 +301,14 @@ Base6::pubKeys()
line = line.stripWhiteSpace();
} else {
// line with new key
- int index4 = error.find(TQRegExp("/\\d{2}/\\d{2} "), index);
+ int index4 = error.tqfind(TQRegExp("/\\d{2}/\\d{2} "), index);
line = error.mid(index4+7,index2-index4-7);
}
//kdDebug(5100) << "Base: found key for " << (const char *)line << endl;
// don't add PGP's comments to the key list
if (strncmp(line.data(),"*** KEY EXPIRED ***",19) &&
- line.find(TQRegExp("^expires \\d{4}/\\d{2}/\\d{2}")) < 0 &&
+ line.tqfind(TQRegExp("^expires \\d{4}/\\d{2}/\\d{2}")) < 0 &&
strncmp(line.data(),"*** DEFAULT SIGNING KEY ***",27)) {
publicKeys.append(line);
}
@@ -319,18 +319,18 @@ Base6::pubKeys()
}
// Also look for pgp key groups
- exiStatus = run("pgp +batchmode +language=C -gv -f");
+ exitqStatus = run("pgp +batchmode +language=C -gv -f");
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return 0;
}
index = 0;
- while ( (index = error.find("\n >", index)) != -1 ) {
+ while ( (index = error.tqfind("\n >", index)) != -1 ) {
TQCString line;
index += 4;
- index2 = error.find(" \"", index);
+ index2 = error.tqfind(" \"", index);
line = error.mid(index, index2-index+1).stripWhiteSpace();
//kdDebug(5100) << "Base6: found key group for " << line << endl;
@@ -352,17 +352,17 @@ Base6::secretKeys( const TQStringList & patterns )
int
Base6::isVersion6()
{
- int exiStatus = 0;
+ int exitqStatus = 0;
- exiStatus = run( PGP6, 0, true );
+ exitqStatus = run( PGP6, 0, true );
- if(exiStatus == -1) {
+ if(exitqStatus == -1) {
errMsg = i18n("error running PGP");
status = RUN_ERR;
return 0;
}
- if( error.find("Version 6") != -1)
+ if( error.tqfind("Version 6") != -1)
{
//kdDebug(5100) << "kpgpbase: pgp version 6.x detected" << endl;
return 1;
@@ -399,14 +399,14 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
int eol;
// search the end of the current line
- if( ( eol = output.find( '\n', offset ) ) == -1 )
+ if( ( eol = output.tqfind( '\n', offset ) ) == -1 )
break;
//kdDebug(5100) << "Parsing: " << output.mid(offset, eol-offset) << endl;
if( firstLine && ( !strncmp( output.data() + offset, "DSS", 3 ) ||
!strncmp( output.data() + offset, "RSA", 3 ) ) )
- { // line tqcontains primary key data
+ { // line contains primary key data
// Example 1:
// RSA 1024 0xE2D074D3 2001/09/09 Test Key <testkey@xyz>
// Example 2 (disabled key):
@@ -465,7 +465,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
pos = offset + 4;
while( output[pos] == ' ' )
pos++;
- pos2 = output.find( ' ', pos );
+ pos2 = output.tqfind( ' ', pos );
subkey->setKeyLength( output.mid( pos, pos2-pos ).toUInt() );
//kdDebug(5100) << "Key Length: "<<subkey->keyLength()<<endl;
@@ -474,7 +474,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
while( output[pos] == ' ' )
pos++;
pos += 2; // skip the '0x'
- pos2 = output.find( ' ', pos );
+ pos2 = output.tqfind( ' ', pos );
subkey->setKeyID( output.mid( pos, pos2-pos ) );
//kdDebug(5100) << "Key ID: "<<subkey->keyID()<<endl;
@@ -482,13 +482,13 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
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 6 anyway doesn't print
// the time this doesn't matter too much.
@@ -554,7 +554,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
else if( !strncmp( output.data() + offset, "DSS", 3 ) ||
!strncmp( output.data() + offset, " DH", 3 ) ||
!strncmp( output.data() + offset, "RSA", 3 ) )
- { // line tqcontains secondary key data (or data for the next key)
+ { // line contains secondary key data (or data for the next key)
if( fpr )
break; // here begins the next key's data
//kdDebug(5100)<<"Secondary key data:\n";
@@ -582,19 +582,19 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
pos = offset + 4;
while( output[pos] == ' ' )
pos++;
- pos2 = output.find( ' ', pos );
+ pos2 = output.tqfind( ' ', pos );
// Key ID (ignored as it is anyway equal to the primary key id)
pos = pos2 + 1;
while( output[pos] == ' ' )
pos++;
- pos2 = output.find( ' ', pos );
+ pos2 = output.tqfind( ' ', pos );
// Creation Date of secondary key (ignored)
pos = pos2 + 1;
while( output[pos] == ' ' )
pos++;
- pos2 = output.find( ' ', pos );
+ pos2 = output.tqfind( ' ', pos );
// User ID or key properties
pos = pos2 + 1;
@@ -639,11 +639,11 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
canEncr = canEncr || encr;
}
else if( !strncmp( output.data() + offset, "Unknown type", 12 ) )
- { // line tqcontains key data of unknown type (ignored)
+ { // line contains key data of unknown type (ignored)
kdDebug(5100)<<"Unknown key type.\n";
}
else if( output[offset] == ' ' )
- { // line tqcontains additional key data
+ { // line contains additional key data
if( key == 0 )
break;
//kdDebug(5100)<<"Additional key data:\n";
@@ -653,7 +653,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
pos++;
if( !strncmp( output.data() + pos, "Key fingerprint = ", 18 ) )
- { // line tqcontains a fingerprint
+ { // line contains a fingerprint
// Example:
// Key fingerprint = D0 6C BB 3A F5 16 82 C4 F3 A0 8A B3 7B 16 99 70
@@ -662,7 +662,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
pos += 18;
TQCString fingerprint = output.mid( pos, eol-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, "" );
//kdDebug(5100)<<"Fingerprint: "<<fingerprint<<endl;
@@ -670,7 +670,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
subkey->setFingerprint( fingerprint );
}
else
- { // line tqcontains an additional user id
+ { // line contains an additional user id
// Example:
// Test key (2nd user ID) <abc@xyz>
@@ -679,7 +679,7 @@ Base6::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
}
}
else if( !strncmp( output.data() + offset, "sig", 3 ) )
- { // line tqcontains signature data (ignored)
+ { // line contains signature data (ignored)
//kdDebug(5100)<<"Signature.\n";
}
else // end of key data
@@ -712,7 +712,7 @@ Base6::parseSingleKey( const TQCString& output, Key* key /* = 0 */ )
offset = 9;
else
{
- offset = output.find( "\nType bits" );
+ offset = output.tqfind( "\nType bits" );
if( offset == -1 )
return 0;
else
@@ -720,7 +720,7 @@ Base6::parseSingleKey( const TQCString& output, Key* key /* = 0 */ )
}
// key data begins in the next line
- offset = output.find( '\n', offset ) + 1;
+ offset = output.tqfind( '\n', offset ) + 1;
if( offset == 0 )
return 0;
@@ -745,13 +745,13 @@ Base6::parseKeyList( const TQCString& output, bool secretKeys )
offset = 0;
else
{
- offset = output.find( "\nType bits" ) + 1;
+ offset = output.tqfind( "\nType bits" ) + 1;
if( offset == 0 )
return keys;
}
// key data begins in the next line
- offset = output.find( '\n', offset ) + 1;
+ offset = output.tqfind( '\n', offset ) + 1;
if( offset == -1 )
return keys;
@@ -782,11 +782,11 @@ Base6::parseTrustDataForKey( Key* key, const TQCString& str )
UserIDList userIDs = key->userIDs();
// search the start of the trust data
- int offset = str.find( "\n\n KeyID" );
+ int offset = str.tqfind( "\n\n KeyID" );
if( offset == -1 )
return;
- offset = str.find( '\n', offset ) + 1;
+ offset = str.tqfind( '\n', offset ) + 1;
if( offset == 0 )
return;
@@ -800,11 +800,11 @@ Base6::parseTrustDataForKey( Key* key, const TQCString& str )
int eol;
// search the end of the current line
- if( ( eol = str.find( '\n', offset ) ) == -1 )
+ if( ( eol = str.tqfind( '\n', offset ) ) == -1 )
break;
if( str[offset+23] != ' ' )
- { // 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;