Autor Thema: Mails incl. Attachments entschlüsseln  (Gelesen 3214 mal)

Offline TMC

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 3.660
  • Geschlecht: Männlich
  • meden agan
Mails incl. Attachments entschlüsseln
« am: 27.04.04 - 22:13:04 »
Hi,

ich will eMails in einem Mailfile entschlüsseln.

Dazu habe ich mir soeben folgendes Script erstellt:
Code
Sub Initialize
   '###################################################################################
   'Purpose:
   'Decrypt emails
   '-------------------------------------------------------------------------------------------------------
   'Usage:
   'Create a Lotus Script agent - "All documents in database" and copy this code to "Initialize".
   '*IMPORTANT*: Run this agent with the same public key (ID-file) that was used to encrypt the documents.
   'Otherwise this will not work!
   '-------------------------------------------------------------------------------------------------------
   'Version         Date               Programmer
   '1.00               04/27/2004      Matthias TMC
   '###################################################################################
   
   On Error Goto ErrorHandler
   Dim session As New Notessession
   Dim db As Notesdatabase
   Dim dc As Notesdocumentcollection
   Dim dcEncrypted As Notesdocumentcollection
   Dim item As NotesItem
   Dim doc As notesdocument
   Dim iCounter As Integer
   Dim iAllCount As Integer
   Set db = session.Currentdatabase
   Set dc = db.allDocuments
   
   '----> We need an empty doccollection
   Set dcEncrypted= db.GetDocumentByUnid(db.Views(0).UniversalID).Responses
   '<----
   
   '------> Search for encrypted docs and put them in the 2nd doc collection
   iCounter = 0
   iAllCount = dc.Count
   Set doc = dc.Getfirstdocument
   While Not doc Is Nothing
      '---> See progress
      iCounter = iCounter +1
      Print iCounter & "of " iAllCount "docs processed."
      '<---
      If doc.IsEncrypted Then
         Call dcEncrypted.AddDocument(doc)
      End If
      Set doc = dc.Getnextdocument(doc)
   Wend
   '<-------
   
   '-----> Message....
   If dcEncrypted.Count = 0 Then
      Msgbox "No documents in this database are encrypted.", 64, db.Title
      Exit Sub
   Else
      If Not Messagebox (dcEncrypted.Count & " documents in this database are encrypted." &Chr(10) &Chr(10)_
      & "Do you really want to decrypt these documents? ",1 + 32,db.Title) = 1 Then Exit Sub
   End If
   '<-------
   
   '--------> Now we remove the encryption stuff
   iCounter = 0
   iAllCount = dcEncrypted.Count
   Set doc = dcEncrypted.GetFirstDocument
   While Not doc Is Nothing
      
      'See progress
      iCounter = iCounter +1
      Print iCounter & "of " iAllCount "docs processed."
      
      'decrypt Body field.....
      Forall i In doc.Items
         If i.Name = "Body" Then
            i.IsEncrypted = False
         End If         
      End Forall      
      
      'decrypt $Files.....
      Forall i In doc.Items
         If i.Name = "$FILE" Then
            i.IsEncrypted = False
         End If         
      End Forall      
      
      'Remove all Encrypt - Items
      While (doc.HasItem("Encrypt"))
         Set item = doc.GetFirstItem("Encrypt")
         Call item.Remove
      Wend
      
      'Remove all $Seal - Items
      While (doc.HasItem("$Seal"))
         Set item = doc.GetFirstItem("$Seal")
         Call item.Remove
      Wend
      
      'Now let's save the cleaned document
      Call doc.Save(False, False)
      Set doc = dcEncrypted.GetNextDocument(doc)
      
   Wend
   '<-----------
   
   Msgbox "The" & dcEncrypted.Count & " documents are decrypted now!", 64, db.Title
   
ExitScript:
   Exit Sub
   
ErrorHandler:
   Msgbox "Error: " & Err & " - " & Error$ & Chr(10) & Chr(10)_
   & "Line: " & Erl & Chr(10)_
   ,48,"An error occured"
   Resume ExitScript
   
End Sub

Alles fein (bei Text), allerdings kann man die Attachments nicht öffnen, diese werden wohl hier nicht entschlüsselt. Ich habe schon extra die $File - Schleife eingebaut, klappt trotzdem nicht.

Woran könnte das liegen? Muss ich da etwa noch eine Frontend-Aktion integrieren? Ist ja immer so eine Sache mit Attachments  :-\

Ich hoffe Ihr habt eine Lösung  ;)
Matthias

A good programmer is someone who looks both ways before crossing a one-way street.


Offline TMC

  • Freund des Hauses!
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 3.660
  • Geschlecht: Männlich
  • meden agan
Re:Mails incl. Attachments entschlüsseln
« Antwort #1 am: 28.04.04 - 20:34:10 »
Matthias

A good programmer is someone who looks both ways before crossing a one-way street.


 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz