3

I am building a plain Text Editor that allows to encrypt, hash or sign passages. Since I want to allow for different Methods (symm/asymm, #Bits etc.), possibly even within the same document, the actually Method used must/should be documented in the same document, preferably directly before the encrypted passage.

I wonder if there is something like a standard plain text Prefix (or Suffix) for encrypted data/signatures similar to the protocol in a URL http:// or mail:// . The concatenated prefix and cipher (base64 encoded, also the encoding should go into the prefix) could look like this:

SHA1://XFe..ks== or 
RSA512://uD4lo...df5= 
1
2

You might be interested in RFC 3369, the Cryptographic Message Syntax standard. It includes the relevant metadata which describes the information you're seeking.

4
  • Thanks, that seems already very detailed and I couldn't find an annotated version of this RFC. Even Wikipedia has only minimal Information: en.wikipedia.org/wiki/Cryptographic_Message_Syntax How would this look like in practice?
    – Spoc
    Aug 22 '16 at 16:30
  • The Windows CryptoAPI directly supports CMS, aka PKCS#7. You could start there, if you're on that platform. Also, see RSA's documents on PKCS#7. They have better examples than the RFC. Aug 22 '16 at 16:36
  • Actually yes, I'm on Windows.NET using CMS and obtain a base64 cipher or hash, but I would like to adorn the result with a Prefix to tell readers which Encryption or hashing was used.
    – Spoc
    Aug 23 '16 at 6:58
  • 2
    There are no standardized text prefixes that meet your requirement. But then, you aren't exactly working with standardized files, so you can do what you need. Take a look at the ASCII-armored PGP file format. The first line parsed starts with ----- BEGIN PGP MESSAGE ----- which is followed by a Version: line, then the base64 encoded details. You could mimic this syntax, and include an Algorithm: line, for example. Aug 23 '16 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.