hi, i was trying to create i little plugin that uses openssl to provide some symmetric ciphers and hash functions. My problem is, that SCI_REPLACESEL expects a 0-terminated string, but it can happen that the encrypted data includes 0-bytes. Notepad++ displays 0-chars (black rectangle with NULL in it), so everything would be fine, if SCI_REPLACESEL expected a string-size as second parameter. Is it somehow possible to insert a NULL char? thx alot!
An option could be to take a detour by the target:
SCI_TARGETFROMSELECTION makes the target equal to the selection
SCI_REPLACETARGET performs a counted string replace
works fine. thx
ok. in case someone wants to try it: here is the first version of my little nppcrypt:
Is this supposed to be still a test/prealpha version, or can it be put on display on the wiki?
i removed another small bug. now it works fine on the 2 pcs i tested it on. would be nice if you could put it on the wiki :)
Only just got chance to look at this. Brilliant, brilliant, brilliant! This is a really great plugin, works perfectly (for me, at least).
I have a couple of requests though, for your consideration:
Can we have a "hex mode", that encrypts/decrypts/hashes to/from ascii HEX.
E.g. 453b349eb3c03b9853 … etc
And, can we have an unsalted encrypt / decrypt too….
So, just two little ticked or unticked menu options? :)
Thanks again, great work!
hoi! here we go: the new version (1.01): www.cerberus-design.de/nppcrypt.zip .
i'm not exactly sure whether the "hex mode" is like you wanted it but give it a try :D
hey, wow, thanks for listening :) That's really great.
(I know how it is when you get loads of requests for a new plugin, but hey, it's all in the name of improvement.. :)
I would have expected the hex mode to encrypt plain text into hex, and decrypt hex into plain text (i.e. that which would be binary is hex, and that which is text, is, well, text ;) - however I don't think it's an issue the way you've done it - TextFX or hexeditor will convert the text to hex if needed - it might be something you want to think about though. Maybe instead of the "failed to read hex" message, it could read it as text. Although that could cause confusion as it may do a different thing when reading "cab" and "cabs".
My other request ("shut up already", i hear you!)… would you mind putting this version on a different URL to the original. I've added this to the Plugin Manager, but when the files change on the same URL it will advise people that the plugin couldn't be authenticated. I'll update it to your new version now, but a new URL for the next version would be good (and I'm hoping there'll be another version, with or without my requests! - SecurePad was liked in the ANSI version, and that wasn't really secure like yours).
If you can, add a version resource so that the DLL shows a version number (it also makes the plugin manager not need to check the hash of the file).
(Excuse me if I'm teaching my grandmother to suck eggs here…) If you're working with Visual Studio Express (i.e. not got a resource editor), you can use copy an existing one and paste it into a .rc file. There's one starting at line 153 here : http://github.com/davegb3/nppPluginManager/blob/master/pluginManager/src/PluginManager.rc
Then just change the bits that are relevant.
Incidentally, I did think about replacing securePad once, and wondered if you could use the NPPN\_FILESAVED and NPPN\_FILEOPENED notifications to automatically encrypt and decrypt a file with a given extension, so someone could have a "passwords.txt.encrypted" file - when they opened it NppCrypt could prompt for a password and decrypt it. When saving, it could prompt again for the password, and re-encrypt the file on disk. I never really played with it, but it should be possible.
Just a thought for the future!
Once again, thanks for a really nice plugin!
hehe, here we go again! the plugin is anything but complex (in fact just an interface to the openssl methods) and i have lots of free time at the moment: so here's another version (1.02): http:/www.cerberus-design.de/nppcryptv102.zip . i tried to implement your great ideas. unfortunately i only have one pc to test it on, so i cannot guarantee "bugfreeness" ^^
ps: the automatic open/save encryption could be done at lot more elegant. do you know how i can tell notepad++ that i want to do the reading/writing myself in NPPN___FILEBEFORESAVE and NPPN__FILEBEFOREOPEN ?
No, I think NPPN\_FILEBEFORESAVE and NPPN\_FILEBEFOREOPEN are just notifications - you can't abort the save/open from them, as far as I know.
Just thought I'd let you know that your changes work great, i like the simplified menus. I was really smiling while I was playing with it. It was slightly tricky to get it to the point where i could open an encrypted file, it decrypt it, then change it, and save it, and it encrypts it again, but once I did, it worked perfectly. I like your little touch about clearing the undo buffer after you open the file, which I presume you must be doing. I did a save-as xxxxx.nppcrypt, and it didn't spot the new name. Not sure if that's the notification you're using or not - I admit I haven't looked into it. Maybe there's another way to "initiate" the encrypted file handling?
I'd recommend you make an announcement in this forum about this plugin - this thread won't be read by everyone that may use this plugin.
Two more things (hey, i'm sorry, they just keep coming to me, but this is a great little tool, and i will be using it daily!)
1. You could, optionally, add a little header to the encrypted file (if in the monitor mode) to identify the algorithm (and confirm the fact it's a nppcrypt), the algorithm could then be pre-selected. This also helps with a potential problem I thought of this morning - if the encrypted binary happens to encrypt to the byte-order-marks of a UTF-8 (or some other encoding), N++ will open it as that encoding, and you won't see those bytes, which will screw pretty much any algorithm. Granted, this isn't all that likely, but possible.
2. When encrypting, it might be an idea to confirm the password.
3 Any chance of AES variants being exposed?
(Did I say 2… I meant 3!)
This is beginning to look like a really exciting plugin - congratz.
PS. If you mention your full name sometime (or send it to me), i'll make sure it goes in the plugin manager and wiki.
would you mind if i abuse you as a tester for the last time? :) i would very much appreciate your comment before i start a new thread because your feedback was extremely helpful.
i further simplified the plugin handling. let me shortly address the points you made:
-> file handling is still not perfect. the problem is the following: fetching the NPPN__FILEBEFORESAVE, the only filename i am able to get via NPPM_GETFULLPATHFROMBUFFERID is the old one e.g. "new 1" or in case of "save as" the original file :/ So up to now it's a little bit tricky to get things started as you mentioned: save file as ".nppcrypt", change something, save it again… no exactly great but at the moment i see no other way to do it …
-> a 4-byte header will now be added to .nppcrypt files in order to avoid accidental BOMs. information on the used encryption is also added so you dont have to remember it yourself :).
-> aes and pw confirmation are included, too.
hope you like it and thx again for your help!
PS: i just realized i totaly messed up the versions…
could you update the plugin manager, so that nppcrypt.zip (the dll without version information!) is 1.001 .
the latest then would be http://www.cerberus-design.de/nppcryptv1003.zip
It's me doing the abusing! This works great, sorry it took me a while to test it. I've not gone through all the options yet, but I will - I think the saving twice isn't really an issue, but there are a couple of options to fix it. One is if the FILESAVING notification changed to pass the filename (this could be done in hwndFrom without breaking anything, I think) - perhaps you (and I, if you want) should put that to Don. The other is a bit nastier and involves checking the filesaved notification after a filesaving, checking if the filename has changed to a .nppcrypt, then running the encryption again (and messing with undo buffers).
However, I think the way you have it is perfectly fine once you know how to do it.
Great job - I'll update the plugin manager probably tomorrow, but might get to the weekend.
PS. No new requests this time… did you notice ;)
the first option would surly be the "cleaner" but in the end i went with the second, which means .nppcrypt files are simply saved twice. Not elegant but it works.
weekend is fine, especially since i already got the next and (hopefully) for some time the last version ready :) provided there are no major bugs…
here it is (1.004) :
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.