Jump to content
  • 0

(Archived) TIP: AppleScript for note with encrypted text


David33409

Idea

I'm working on a way to automatically encrypt sensitive data (social security #'s, credit card #'s, account #'s, etc.) using AppleScript. I've tried to create notes with the en-crypt elements with no success. Has anyone tried this and got it to work? Does Evernote have a policy of preventing this work working from AppleScript?

Thank you in advance for your time and consideration.

David

Link to comment

8 replies to this idea

Recommended Posts

I was able to successfully create a note with the en-crypt tags; however, I'm still trying to track down the logic Evernote uses to perform he encryption. I have the decryption side in Javascript and I'm currently using AppleScript to find the notes with sensitive data and substituting the en-crypt tags. As soon as I get the encryption logic taken care of I'll post the solution.

Below is a sample of what I have and it works great (the text encrypted is "sensitive data", the password is "test"). The code below will add a new note with encrypted text to the notebook of your choice IMPORT_NOTEBOOK and tag it with "Sensitive":


try
set theText to "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" & return
set theText to theText & "<note><title>Sample Note</title><tag>Sensitive</tag><content><![CDATA[<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" & return
set theText to theText & "<!DOCTYPE en-note SYSTEM \"http://xml.evernote.com/pub/enml2.dtd\">" & return
set theText to theText & "<en-note style=\"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;\">" & return
set theText to theText & "Here is the <en-crypt cipher=\"RC2\" length=\"64\">5hUJxMEAGwvsVSky5d7JGmtIpsrec+RUUt1gYMqK7x3rL8wwHd2VpMEyIPrFwkYQX5kf/YDER5NgebLiMdYu32Fu1Vz+hXYOTp/dFMHUXo4UMgrixqoSwMzBC6W9hDYlqjYN9rlD9lxshmlOPhM8apABgVkoPblXmTsOnVMFLVtmDOYDtloUs/ccGftVwXuWoZzMmIX7sT4AE7X48Y+42Hc/kN40SPFwC9ank4Uzf2NQRrYQRDS/Z6o2Dfa5Q/ZcPoiJ//CNvVqdt+izjx+r3LTe47qVvIEdWcKS10KTuOsPR6IZpiC4AY3CUI4zs0yGjyuodbRICL2KxiLEghILkeruxF/5LAVp17mCi1Nz/DlGGrrJKhaQpny+xvMlkk1GtKW2rg3sM7/d0bM+lpw5pz1P2SZ1uuwEUEncFdTVZg3yWbcObJYYer83NISpIg+iL1F/YXNmQoipSGtGhRv9GVBJ3BXU1WYN8lm3DmyWGHq/NzSEqSIPorsTCq1m2GFH0jD0BMVDJZQwuJcu1HONBQ22OZxUi/hDe6VdevOn9qF422gwo60+VGBfJuqjxSGupT5bOMl3JfvyWbcObJYYetqQV2E6REApjlOajQbF9IqLaxzUlZCiqPJZtw5slhh62pBXYTpEQCmUuFkxJdIYo1i3+lJFgJozrM9HtO7B/eWMPCXolBvzSbxema+ERbD3VsVcnaDgQSZsnO/4ZHlC5t+oYjROceyW</en-crypt> end" & return
set theText to theText & "</en-note>"
set theText to theText & "]]></content></note>"

set theFilePath to (path to desktop as string) & "david33409.enex" as string
set theFileReference to open for access theFilePath with write permission
write theText to theFileReference
close access theFileReference
tell application "Evernote"
activate
create note from file theFilePath notebook IMPORT_NOTEBOOK tags
end tell

-- Delete the file
tell application "Finder"
delete file theFilePath
end tell

-- Check for errors
on error errStr number errorNumber
display dialog "An error occurred:" & return & "[" & errorNumber & "]" & errStr
end try

With the above code working I am able to scan my notes and substitute sensitive tokens. I'll post more later.

David

Link to comment

Archived

This topic is now archived and is closed to further replies.

Guest
This topic is now closed to further replies.
×
×
  • Create New...