19 #include "kpgpblock.h" 26 Block::Block( const TQCString& str ) 27 : mText(str), mProcessedText(), mError(), 28 mSignatureUserId(), mSignatureKeyId(), mSignatureDate(), 29 mRequiredKey(), mEncryptedFor(), 30 mStatus(0), mHasBeenProcessed(false), mType(NoPgpBlock) 32 mEncryptedFor.setAutoDelete( true ); 42 mProcessedText = TQCString(); 44 mSignatureUserId = TQString(); 45 mSignatureKeyId = TQCString(); 46 mSignatureDate = TQCString(); 47 mRequiredKey = TQCString(); 48 mEncryptedFor.clear(); 50 mHasBeenProcessed = false; 62 Block::determineType() const 64 if( !strncmp( mText.data(), "-----BEGIN PGP ", 15 ) ) 66 if( !strncmp( mText.data() + 15, "SIGNED", 6 ) ) 67 return ClearsignedBlock; 68 else if( !strncmp( mText.data() + 15, "SIGNATURE", 9 ) ) 69 return SignatureBlock; 70 else if( !strncmp( mText.data() + 15, "PUBLIC", 6 ) ) 71 return PublicKeyBlock; 72 else if( !strncmp( mText.data() + 15, "PRIVATE", 7 ) || 73 !strncmp( mText.data() + 15, "SECRET", 6 ) ) 74 return PrivateKeyBlock; 75 else if( !strncmp( mText.data() + 15, "MESSAGE", 7 ) ) 77 if( !strncmp( mText.data() + 22, ", PART", 6 ) ) 78 return MultiPgpMessageBlock; 80 return PgpMessageBlock; 82 else if( !strncmp( mText.data() + 15, "ARMORED FILE", 12 ) ) 83 return PgpMessageBlock; 94 Kpgp::Module *pgp = Kpgp::Module::getKpgp(); 99 return pgp->decrypt( * this ); 105 Kpgp::Module *pgp = Kpgp::Module::getKpgp(); 110 return pgp->verify( * this ); 114 Block::clearsign( const TQCString& keyId, const TQCString& charset ) 116 Kpgp::Module *pgp = Kpgp::Module::getKpgp(); 119 return Kpgp::Failure; 121 return pgp->clearsign( * this, keyId, charset ); 125 Block::encrypt( const TQStringList& receivers, const TQCString& keyId, 126 const bool sign, const TQCString& charset ) 128 Kpgp::Module *pgp = Kpgp::Module::getKpgp(); 131 return Kpgp::Failure; 133 return pgp->encrypt( * this, receivers, keyId, sign, charset );
|