diff options
Diffstat (limited to 'libkpgp/kpgpbase5.cpp')
-rw-r--r-- | libkpgp/kpgpbase5.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/libkpgp/kpgpbase5.cpp b/libkpgp/kpgpbase5.cpp index a5988a9cb..d78998475 100644 --- a/libkpgp/kpgpbase5.cpp +++ b/libkpgp/kpgpbase5.cpp @@ -66,7 +66,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, const char *passphrase ) { TQCString cmd; - int exiStatus = 0; + int exitqStatus = 0; int index; // used to work around a bug in pgp5. pgp5 treats files // with non ascii chars (umlauts, etc...) as binary files, but @@ -116,14 +116,14 @@ Base5::encsign( Block& block, const KeyIDList& recipients, } //We have to do this otherwise it's all in vain - exiStatus = run(cmd.data(), passphrase); + exitqStatus = run(cmd.data(), passphrase); block.setError( error ); - if(exiStatus != 0) + if(exitqStatus != 0) status = ERROR; // now parse the returned info - if(error.find("Cannot unlock private key") != -1) + if(error.tqfind("Cannot unlock private key") != -1) { errMsg = i18n("The passphrase you entered is invalid."); status |= ERROR; @@ -133,16 +133,16 @@ Base5::encsign( Block& block, const KeyIDList& recipients, //{ TQCString aStr; index = -1; - while((index = error.find("WARNING: The above key",index+1)) != -1) + while((index = error.tqfind("WARNING: The above key",index+1)) != -1) { - int index2 = error.find("But you previously",index); - int index3 = error.find("WARNING: The above key",index+1); + int index2 = error.tqfind("But you previously",index); + int index3 = error.tqfind("WARNING: The above key",index+1); if(index2 == -1 || (index2 > index3 && index3 != -1)) { // the key wasn't valid, no encryption to this person // extract the person - index2 = error.find('\n',index); - index3 = error.find('\n',index2+1); + index2 = error.tqfind('\n',index); + index3 = error.tqfind('\n',index2+1); aStr += error.mid(index2+1, index3-index2-1); aStr += ", "; } @@ -150,7 +150,7 @@ Base5::encsign( Block& block, const KeyIDList& recipients, if(!aStr.isEmpty()) { aStr.truncate(aStr.length()-2); - if(error.find("No valid keys found") != -1) + if(error.tqfind("No valid keys found") != -1) errMsg = i18n("The key(s) you want to encrypt your message " "to are not trusted. No encryption done."); else @@ -161,10 +161,10 @@ Base5::encsign( Block& block, const KeyIDList& recipients, status |= BADKEYS; } //} - if((index = error.find("No encryption keys found for")) != -1) + if((index = error.tqfind("No encryption keys found for")) != -1) { - index = error.find(':',index); - int index2 = error.find('\n',index); + index = error.tqfind(':',index); + int index2 = error.tqfind('\n',index); errMsg = i18n("Missing encryption key(s) for:\n%1") .arg(error.mid(index,index2-index)); @@ -178,14 +178,14 @@ Base5::encsign( Block& block, const KeyIDList& recipients, // dash-escape the input if (input[0] == '-') input = "- " + input; - for ( int idx = 0 ; (idx = input.find("\n-", idx)) >= 0 ; idx += 4 ) + for ( int idx = 0 ; (idx = input.tqfind("\n-", idx)) >= 0 ; idx += 4 ) input.tqreplace(idx, 2, "\n- -"); output = "-----BEGIN PGP SIGNED MESSAGE-----\n\n" + input + "\n" + output; } block.setProcessedText( output ); - block.seStatus( status ); + block.setqStatus( status ); return status; } @@ -193,26 +193,26 @@ Base5::encsign( Block& block, const KeyIDList& recipients, int Base5::decrypt( Block& block, const char *passphrase ) { - int exiStatus = 0; + int exitqStatus = 0; clear(); input = block.text(); - exiStatus = run("pgpv -f +batchmode=1", passphrase); + exitqStatus = run("pgpv -f +batchmode=1", 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; } // lets parse the returned information. int index; - index = error.find("Cannot decrypt message"); + index = error.tqfind("Cannot decrypt message"); if(index != -1) { //kdDebug(5100) << "message is encrypted" << endl; @@ -220,7 +220,7 @@ Base5::decrypt( Block& block, const char *passphrase ) // ok. we have an encrypted message. Is the passphrase bad, // or do we not have the secret key? - if(error.find("Need a pass phrase") != -1) + if(error.tqfind("Need a pass phrase") != -1) { if(passphrase != 0) { @@ -242,15 +242,15 @@ Base5::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 decrypted by:"); + index = error.tqfind("can only be decrypted 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(); int index2; - 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(); @@ -260,7 +260,7 @@ Base5::decrypt( Block& block, const char *passphrase ) } #endif } - index = error.find("Good signature"); + index = error.tqfind("Good signature"); if(index != -1) { //kdDebug(5100) << "good signature" << endl; @@ -268,18 +268,18 @@ Base5::decrypt( Block& block, const char *passphrase ) status |= GOODSIG; // get key ID of signer - index = error.find("Key ID ", index) + 7; + index = error.tqfind("Key ID ", index) + 7; block.setSignatureKeyId( error.mid(index, 8) ); // get signer - index = error.find('"',index) + 1; - int index2 = error.find('"', index); + index = error.tqfind('"',index) + 1; + int index2 = error.tqfind('"', index); block.setSignatureUserId( error.mid(index, index2-index) ); /// ### FIXME get signature date block.setSignatureDate( "" ); } - index = error.find("BAD signature"); + index = error.tqfind("BAD signature"); if(index != -1) { //kdDebug(5100) << "BAD signature" << endl; @@ -287,23 +287,23 @@ Base5::decrypt( Block& block, const char *passphrase ) status |= ERROR; // get key ID of signer - index = error.find("Key ID ", index) + 7; + index = error.tqfind("Key ID ", index) + 7; block.setSignatureKeyId( error.mid(index, 8) ); // get signer - index = error.find('"',index) + 1; - int index2 = error.find('"', index); + index = error.tqfind('"',index) + 1; + int index2 = error.tqfind('"', index); block.setSignatureUserId( error.mid(index, index2-index) ); /// ### FIXME get signature date block.setSignatureDate( "" ); } - index = error.find("Signature by unknown key"); + index = error.tqfind("Signature by unknown key"); if(index != -1) { - index = error.find("keyid: 0x",index) + 9; + index = error.tqfind("keyid: 0x",index) + 9; block.setSignatureKeyId( error.mid(index, 8) ); - block.setSignatureUserId( TQString::null ); + block.setSignatureUserId( TQString() ); // FIXME: not a very good solution... status |= SIGNED; status |= GOODSIG; @@ -313,7 +313,7 @@ Base5::decrypt( Block& block, const char *passphrase ) } //kdDebug(5100) << "status = " << status << endl; - block.seStatus( status ); + block.setqStatus( status ); return status; } @@ -321,12 +321,12 @@ Base5::decrypt( Block& block, const char *passphrase ) Key* Base5::readPublicKey( const KeyID& keyId, const bool readTrust, Key* key ) { - int exiStatus = 0; + int exitqStatus = 0; status = 0; - exiStatus = run( "pgpk -ll 0x" + keyId, 0, true ); + exitqStatus = run( "pgpk -ll 0x" + keyId, 0, true ); - if(exiStatus != 0) { + if(exitqStatus != 0) { status = ERROR; return 0; } @@ -340,9 +340,9 @@ Base5::readPublicKey( const KeyID& keyId, const bool readTrust, Key* key ) if( readTrust ) { - exiStatus = run( "pgpk -c 0x" + keyId, 0, true ); + exitqStatus = run( "pgpk -c 0x" + keyId, 0, true ); - if(exiStatus != 0) { + if(exitqStatus != 0) { status = ERROR; return 0; } @@ -357,7 +357,7 @@ Base5::readPublicKey( const KeyID& keyId, const bool readTrust, Key* key ) KeyList Base5::publicKeys( const TQStringList & patterns ) { - int exiStatus = 0; + int exitqStatus = 0; TQCString cmd = "pgpk -ll"; for ( TQStringList::ConstIterator it = patterns.begin(); @@ -366,9 +366,9 @@ Base5::publicKeys( const TQStringList & patterns ) cmd += KProcess::quote( *it ).local8Bit(); } status = 0; - exiStatus = run( cmd, 0, true ); + exitqStatus = run( cmd, 0, true ); - if(exiStatus != 0) { + if(exitqStatus != 0) { status = ERROR; return KeyList(); } @@ -386,7 +386,7 @@ Base5::publicKeys( const TQStringList & patterns ) KeyList Base5::secretKeys( const TQStringList & patterns ) { - int exiStatus = 0; + int exitqStatus = 0; status = 0; TQCString cmd = "pgpk -ll"; @@ -396,9 +396,9 @@ Base5::secretKeys( const TQStringList & patterns ) cmd += KProcess::quote( *it ).local8Bit(); } status = 0; - exiStatus = run( cmd, 0, true ); + exitqStatus = run( cmd, 0, true ); - if(exiStatus != 0) { + if(exitqStatus != 0) { status = ERROR; return KeyList(); } @@ -415,15 +415,15 @@ Base5::secretKeys( const TQStringList & patterns ) TQCString Base5::getAsciiPublicKey(const KeyID& keyID) { - int exiStatus = 0; + int exitqStatus = 0; if (keyID.isEmpty()) return TQCString(); status = 0; - exiStatus = run( "pgpk -xa 0x" + keyID, 0, true ); + exitqStatus = run( "pgpk -xa 0x" + keyID, 0, true ); - if(exiStatus != 0) { + if(exitqStatus != 0) { status = ERROR; return TQCString(); } @@ -436,7 +436,7 @@ int Base5::signKey(const KeyID& keyID, const char *passphrase) { TQCString cmd; - int exiStatus = 0; + int exitqStatus = 0; if(passphrase == 0) return false; @@ -445,9 +445,9 @@ Base5::signKey(const KeyID& keyID, const char *passphrase) cmd += addUserId(); status = 0; - exiStatus = run(cmd.data(), passphrase); + exitqStatus = run(cmd.data(), passphrase); - if (exiStatus != 0) + if (exitqStatus != 0) status = ERROR; return status; @@ -483,7 +483,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) int eol; // search the end of the current line - eol = output.find( '\n', offset ); + eol = output.tqfind( '\n', offset ); if( ( eol == -1 ) || ( eol == offset ) ) break; @@ -492,7 +492,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) if( !strncmp( output.data() + offset, "pub", 3 ) || !strncmp( output.data() + offset, "sec", 3 ) || !strncmp( output.data() + offset, "sub", 3 ) ) - { // line tqcontains key data + { // line contains key data //kdDebug(5100)<<"Key data:\n"; int pos, pos2; @@ -525,7 +525,7 @@ Base5::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; @@ -534,7 +534,7 @@ Base5::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; @@ -542,13 +542,13 @@ Base5::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 5 anyway doesn't print // the time this doesn't matter too much. @@ -561,7 +561,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.find( ' ', pos ); + pos2 = output.tqfind( ' ', pos ); if( output[pos] == '-' ) { // key doesn't expire subkey->setExpirationDate( -1 ); @@ -595,7 +595,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) pos = pos2 + 1; while( output[pos] == ' ' ) pos++; - pos2 = output.find( ' ', pos ); + pos2 = output.tqfind( ' ', pos ); if( !strncmp( output.data() + pos, "RSA", 3 ) ) { sign = true; @@ -647,23 +647,23 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) } else if( !strncmp( output.data() + offset, "f16", 3 ) || !strncmp( output.data() + offset, "f20", 3 ) ) - { // line tqcontains a fingerprint + { // line contains a fingerprint /* Examples: f16 Fingerprint16 = DE 2A 77 08 78 64 7C 42 72 75 B1 A7 3E 42 3F 79 f20 Fingerprint20 = 226F 4B63 6DA2 7389 91D1 2A49 D58A 3EC1 5214 181E */ - int pos = output.find( '=', offset+3 ) + 2; + int pos = output.tqfind( '=', offset+3 ) + 2; 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, "" ); assert( subkey != 0 ); subkey->setFingerprint( fingerprint ); //kdDebug(5100)<<"Fingerprint: "<<fingerprint<<endl; } else if( !strncmp( output.data() + offset, "uid", 3 ) ) - { // line tqcontains a uid + { // line contains a uid int pos = offset+5; TQCString uid = output.mid( pos, eol-pos ); key->addUserID( uid ); @@ -678,7 +678,7 @@ Base5::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ ) else if ( !strncmp( output.data() + offset, "sig", 3 ) || !strncmp( output.data() + offset, "SIG", 3 ) || !strncmp( output.data() + offset, "ret", 3 ) ) - { // line tqcontains a signature + { // line contains a signature // SIG = sig with own key; ret = sig with revoked key // we ignore it for now } @@ -700,13 +700,13 @@ Base5::parseSingleKey( const TQCString& output, Key* key /* = 0 */ ) offset = 0; else { - offset = output.find( "\nType Bits" ) + 1; + offset = output.tqfind( "\nType Bits" ) + 1; if( offset == 0 ) return 0; } // key data begins in the next line - offset = output.find( '\n', offset ) + 1; + offset = output.tqfind( '\n', offset ) + 1; if( offset == -1 ) return 0; @@ -730,13 +730,13 @@ Base5::parseKeyList( const TQCString& output, bool onlySecretKeys ) 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; @@ -770,11 +770,11 @@ Base5::parseTrustDataForKey( Key* key, const TQCString& str ) UserIDList userIDs = key->userIDs(); // search the start of the trust data - int offset = str.find( "\n\n KeyID" ) + 9; + int offset = str.tqfind( "\n\n KeyID" ) + 9; if( offset == -1 + 9 ) return; - offset = str.find( '\n', offset ) + 1; + offset = str.tqfind( '\n', offset ) + 1; if( offset == -1 + 1 ) return; @@ -788,11 +788,11 @@ Base5::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; |