summaryrefslogtreecommitdiffstats
path: root/libkpgp/kpgpbaseG.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkpgp/kpgpbaseG.cpp')
-rw-r--r--libkpgp/kpgpbaseG.cpp140
1 files changed, 70 insertions, 70 deletions
diff --git a/libkpgp/kpgpbaseG.cpp b/libkpgp/kpgpbaseG.cpp
index 5aa619ec6..d9adb11a2 100644
--- a/libkpgp/kpgpbaseG.cpp
+++ b/libkpgp/kpgpbaseG.cpp
@@ -38,7 +38,7 @@ BaseG::BaseG()
{
// determine the version of gpg (the method is equivalent to gpgme's method)
runGpg( "--version", 0 );
- int eol = output.find( '\n' );
+ int eol = output.tqfind( '\n' );
if( eol > 0 ) {
int pos = output.findRev( ' ', eol - 1 );
if( pos != -1 ) {
@@ -73,7 +73,7 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
const char *passphrase )
{
TQCString cmd;
- int exiStatus = 0;
+ int exitqStatus = 0;
if(!recipients.isEmpty() && passphrase != 0)
cmd = "--batch --armor --sign --encrypt --textmode";
@@ -109,12 +109,12 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
clear();
input = block.text();
- exiStatus = runGpg(cmd.data(), passphrase);
+ exitqStatus = runGpg(cmd.data(), passphrase);
if( !output.isEmpty() )
block.setProcessedText( output );
block.setError( error );
- if( exiStatus != 0 )
+ if( exitqStatus != 0 )
{
// this error message is later hopefully overwritten
errMsg = i18n( "Unknown error." );
@@ -138,11 +138,11 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
// (expired or revoked key)
// gpg: 23456789: no info to calculate a trust probability
// (untrusted key, 23456789 is the key Id of the encryption sub key)
- while((index = error.find("skipped: ",index)) != -1)
+ while((index = error.tqfind("skipped: ",index)) != -1)
{
bad = TRUE;
- index = error.find('\'',index);
- int index2 = error.find('\'',index+1);
+ index = error.tqfind('\'',index);
+ int index2 = error.tqfind('\'',index+1);
badkeys += error.mid(index, index2-index+1) + ", ";
num++;
}
@@ -178,14 +178,14 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
// Example 4 (unusable secret key, sign & encrypt):
// gpg: skipped `0xAC0EB35D': unusable secret key
// gpg: [stdin]: sign+encrypt failed: unusable secret key
- if( error.find("bad passphrase") != -1 )
+ if( error.tqfind("bad passphrase") != -1 )
{
errMsg = i18n("Signing failed because the passphrase is wrong.");
status |= BADPHRASE;
status |= ERR_SIGNING;
status |= ERROR;
}
- else if( error.find("unusable secret key") != -1 )
+ else if( error.tqfind("unusable secret key") != -1 )
{
errMsg = i18n("Signing failed because your secret key is unusable.");
status |= ERR_SIGNING;
@@ -199,7 +199,7 @@ BaseG::encsign( Block& block, const KeyIDList& recipients,
}
//kdDebug(5100) << "status = " << status << endl;
- block.seStatus( status );
+ block.setqStatus( status );
return status;
}
@@ -208,19 +208,19 @@ int
BaseG::decrypt( Block& block, const char *passphrase )
{
int index, index2;
- int exiStatus = 0;
+ int exitqStatus = 0;
clear();
input = block.text();
- exiStatus = runGpg("--batch --decrypt", passphrase);
- if( !output.isEmpty() && ( error.find( "gpg: quoted printable" ) == -1 ) )
+ exitqStatus = runGpg("--batch --decrypt", passphrase);
+ if( !output.isEmpty() && ( error.tqfind( "gpg: quoted printable" ) == -1 ) )
block.setProcessedText( output );
block.setError( error );
- if(exiStatus == -1) {
+ if(exitqStatus == -1) {
errMsg = i18n("Error running gpg");
status = RUN_ERR;
- block.seStatus( status );
+ block.setqStatus( status );
return status;
}
@@ -244,13 +244,13 @@ BaseG::decrypt( Block& block, const char *passphrase )
// gpg: public key decryption failed: bad passphrase
// gpg: encrypted with 2048-bit ELG-E key, ID 23456789, created 2000-02-02
// "Foo Bar (home) <foo@bar.xyz>"
- if( error.find( "gpg: encrypted with" ) != -1 )
+ if( error.tqfind( "gpg: encrypted with" ) != -1 )
{
//kdDebug(5100) << "kpgpbase: message is encrypted" << endl;
status |= ENCRYPTED;
- if( error.find( "\ngpg: decryption failed" ) != -1 )
+ if( error.tqfind( "\ngpg: decryption failed" ) != -1 )
{
- if( ( index = error.find( "bad passphrase" ) ) != -1 )
+ if( ( index = error.tqfind( "bad passphrase" ) ) != -1 )
{
if( passphrase != 0 )
{
@@ -270,7 +270,7 @@ BaseG::decrypt( Block& block, const char *passphrase )
kdDebug(5100) << "Base: key needed is \"" << block.requiredUserId() << "\"!" << endl;
}
}
- else if( error.find( "secret key not available" ) != -1 )
+ else if( error.tqfind( "secret key not available" ) != -1 )
{
// no secret key fitting this message
status |= NO_SEC_KEY;
@@ -283,14 +283,14 @@ BaseG::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();
@@ -304,48 +304,48 @@ BaseG::decrypt( Block& block, const char *passphrase )
// Example 1 (unknown signature key):
// gpg: Signature made Wed 02 Jan 2002 11:26:33 AM CET using DSA key ID 2E250C64
// gpg: Can't check signature: public key not found
- if((index = error.find("Signature made")) != -1)
+ if((index = error.tqfind("Signature made")) != -1)
{
//kdDebug(5100) << "Base: message is signed" << endl;
status |= SIGNED;
// get signature date and signature key ID
// Example: Signature made Sun 06 May 2001 03:49:27 PM CEST using DSA key ID 12345678
- index2 = error.find("using", index+15);
+ index2 = error.tqfind("using", index+15);
block.setSignatureDate( error.mid(index+15, index2-(index+15)-1) );
kdDebug(5100) << "Message was signed on '" << block.signatureDate() << "'\n";
- index2 = error.find("key ID ", index2) + 7;
+ index2 = error.tqfind("key ID ", index2) + 7;
block.setSignatureKeyId( error.mid(index2,8) );
kdDebug(5100) << "Message was signed with key '" << block.signatureKeyId() << "'\n";
// move index to start of next line
- index = error.find('\n', index2)+1;
+ index = error.tqfind('\n', index2)+1;
- if ((error.find("Key matching expected", index) != -1)
- || (error.find("Can't check signature", index) != -1))
+ if ((error.tqfind("Key matching expected", index) != -1)
+ || (error.tqfind("Can't check signature", index) != -1))
{
status |= UNKNOWN_SIG;
status |= GOODSIG;
- block.setSignatureUserId( TQString::null );
+ block.setSignatureUserId( TQString() );
}
- else if( error.find("Good signature", index) != -1 )
+ else if( error.tqfind("Good signature", index) != -1 )
{
status |= GOODSIG;
// get the primary user ID of the signer
- index = error.find('"',index);
- index2 = error.find('\n',index+1);
+ index = error.tqfind('"',index);
+ index2 = error.tqfind('\n',index+1);
index2 = error.findRev('"', index2-1);
block.setSignatureUserId( error.mid( index+1, index2-index-1 ) );
}
- else if( error.find("BAD signature", index) != -1 )
+ else if( error.tqfind("BAD signature", index) != -1 )
{
//kdDebug(5100) << "BAD signature" << endl;
status |= ERROR;
// get the primary user ID of the signer
- index = error.find('"',index);
- index2 = error.find('\n',index+1);
+ index = error.tqfind('"',index);
+ index2 = error.tqfind('\n',index+1);
index2 = error.findRev('"', index2-1);
block.setSignatureUserId( error.mid( index+1, index2-index-1 ) );
}
- else if( error.find("Can't find the right public key", index) != -1 )
+ else if( error.tqfind("Can't find the right public key", index) != -1 )
{
// #### fix this hack
// I think this can't happen anymore because if the pubring is missing
@@ -357,11 +357,11 @@ BaseG::decrypt( Block& block, const char *passphrase )
else
{
status |= ERROR;
- block.setSignatureUserId( TQString::null );
+ block.setSignatureUserId( TQString() );
}
}
//kdDebug(5100) << "status = " << status << endl;
- block.seStatus( status );
+ block.setqStatus( status );
return status;
}
@@ -371,15 +371,15 @@ BaseG::readPublicKey( const KeyID& keyID,
const bool readTrust /* = false */,
Key* key /* = 0 */ )
{
- int exiStatus = 0;
+ int exitqStatus = 0;
status = 0;
if( readTrust )
- exiStatus = runGpg( "--batch --list-public-keys --with-fingerprint --with-colons --fixed-list-mode 0x" + keyID, 0, true );
+ exitqStatus = runGpg( "--batch --list-public-keys --with-fingerprint --with-colons --fixed-list-mode 0x" + keyID, 0, true );
else
- exiStatus = runGpg( "--batch --list-public-keys --with-fingerprint --with-colons --fixed-list-mode --no-expensive-trust-checks 0x" + keyID, 0, true );
+ exitqStatus = runGpg( "--batch --list-public-keys --with-fingerprint --with-colons --fixed-list-mode --no-expensive-trust-checks 0x" + keyID, 0, true );
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return 0;
}
@@ -389,7 +389,7 @@ BaseG::readPublicKey( const KeyID& keyID,
if( !strncmp( output.data(), "pub:", 4 ) )
offset = 0;
else {
- offset = output.find( "\npub:" );
+ offset = output.tqfind( "\npub:" );
if( offset == -1 )
return 0;
else
@@ -405,7 +405,7 @@ BaseG::readPublicKey( const KeyID& keyID,
KeyList
BaseG::publicKeys( const TQStringList & patterns )
{
- int exiStatus = 0;
+ int exitqStatus = 0;
// the option --with-colons should be used for interprocess communication
// with gpg (according to Werner Koch)
@@ -417,9 +417,9 @@ BaseG::publicKeys( const TQStringList & patterns )
cmd += KProcess::quote( *it ).local8Bit();
}
status = 0;
- exiStatus = runGpg( cmd, 0, true );
+ exitqStatus = runGpg( cmd, 0, true );
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return KeyList();
}
@@ -437,7 +437,7 @@ BaseG::publicKeys( const TQStringList & patterns )
KeyList
BaseG::secretKeys( const TQStringList & patterns )
{
- int exiStatus = 0;
+ int exitqStatus = 0;
// the option --with-colons should be used for interprocess communication
// with gpg (according to Werner Koch)
@@ -449,9 +449,9 @@ BaseG::secretKeys( const TQStringList & patterns )
cmd += KProcess::quote( *it ).local8Bit();
}
status = 0;
- exiStatus = runGpg( cmd, 0, true );
+ exitqStatus = runGpg( cmd, 0, true );
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return KeyList();
}
@@ -470,7 +470,7 @@ int
BaseG::signKey(const KeyID& keyID, const char *passphrase)
{
TQCString cmd;
- int exiStatus = 0;
+ int exitqStatus = 0;
cmd = "--batch";
cmd += addUserId();
@@ -478,27 +478,27 @@ BaseG::signKey(const KeyID& keyID, const char *passphrase)
cmd += keyID;
status = 0;
- exiStatus = runGpg(cmd.data(), passphrase);
+ exitqStatus = runGpg(cmd.data(), passphrase);
- if (exiStatus != 0)
+ if (exitqStatus != 0)
status = ERROR;
return status;
}
-QCString
+TQCString
BaseG::getAsciiPublicKey(const KeyID& keyID)
{
- int exiStatus = 0;
+ int exitqStatus = 0;
if (keyID.isEmpty())
return TQCString();
status = 0;
- exiStatus = runGpg("--batch --armor --export 0x" + keyID, 0, true);
+ exitqStatus = runGpg("--batch --armor --export 0x" + keyID, 0, true);
- if(exiStatus != 0) {
+ if(exitqStatus != 0) {
status = ERROR;
return TQCString();
}
@@ -536,13 +536,13 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
{
int eol;
// search the end of the current line
- if( ( eol = output.find( '\n', index ) ) == -1 )
+ if( ( eol = output.tqfind( '\n', index ) ) == -1 )
break;
bool bIsPublicKey = false;
if( ( bIsPublicKey = !strncmp( output.data() + index, "pub:", 4 ) )
|| !strncmp( output.data() + index, "sec:", 4 ) )
- { // line tqcontains primary key data
+ { // line contains primary key data
// Example: pub:f:1024:17:63CB691DFAEBD5FC:860451781::379:-:::scESC:
// abort parsing if we found the start of the next key
@@ -555,7 +555,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
Subkey *subkey = new Subkey( TQCString(), !bIsPublicKey );
int pos = index + 4; // begin of 2nd field
- int pos2 = output.find( ':', pos );
+ int pos2 = output.tqfind( ':', pos );
for( int field = 2; field <= 12; field++ )
{
switch( field )
@@ -652,18 +652,18 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
break;
}
pos = pos2 + 1;
- pos2 = output.find( ':', pos );
+ pos2 = output.tqfind( ':', pos );
}
key->addSubkey( subkey );
}
else if( !strncmp( output.data() + index, "uid:", 4 ) )
- { // line tqcontains a user id
+ { // line contains a user id
// Example: uid:f::::::::Philip R. Zimmermann <prz@pgp.com>:
UserID *userID = new UserID( "" );
int pos = index + 4; // begin of 2nd field
- int pos2 = output.find( ':', pos );
+ int pos2 = output.tqfind( ':', pos );
for( int field=2; field <= 10; field++ )
{
switch( field )
@@ -713,7 +713,7 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
// tqreplace "\xXX" with the corresponding character;
// other escaped characters, i.e. \n, \r etc., are ignored
// because they shouldn't appear in user IDs
- for ( int idx = 0 ; (idx = uid.find( "\\x", idx )) >= 0 ; ++idx ) {
+ for ( int idx = 0 ; (idx = uid.tqfind( "\\x", idx )) >= 0 ; ++idx ) {
char str[2] = "x";
str[0] = (char) TQString( uid.mid( idx + 2, 2 ) ).toShort( 0, 16 );
uid.tqreplace( idx, 4, str );
@@ -785,14 +785,14 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
break;
}
pos = pos2 + 1;
- pos2 = output.find( ':', pos );
+ pos2 = output.tqfind( ':', pos );
}
// user IDs are printed in UTF-8 by gpg (if one uses --with-colons)
key->addUserID( userID );
}
else if( !strncmp( output.data() + index, "fpr:", 4 ) )
- { // line tqcontains a fingerprint
+ { // line contains a fingerprint
// Example: fpr:::::::::17AFBAAF21064E513F037E6E63CB691DFAEBD5FC:
if (key == 0) // invalid key data
@@ -801,8 +801,8 @@ BaseG::parseKeyData( const TQCString& output, int& offset, Key* key /* = 0 */ )
// search the fingerprint (it's in the 10th field)
int pos = index + 4;
for( int i = 0; i < 8; i++ )
- pos = output.find( ':', pos ) + 1;
- int pos2 = output.find( ':', pos );
+ pos = output.tqfind( ':', pos ) + 1;
+ int pos2 = output.tqfind( ':', pos );
key->setFingerprint( keyID, output.mid( pos, pos2-pos ) );
}
@@ -830,9 +830,9 @@ BaseG::parseKeyList( const TQCString& output, bool secretKeys )
offset = 0;
else {
if( secretKeys )
- offset = output.find( "\nsec:" );
+ offset = output.tqfind( "\nsec:" );
else
- offset = output.find( "\npub:" );
+ offset = output.tqfind( "\npub:" );
if( offset == -1 )
return keys;
else