Encrypted Loggers or Custom LoggerTypes?
-
Is it possible to create a logger that produces an encrypted file? I can't see any option for this so I don't think it is possible.
So my next question is can we implement our own loggers? That can be attached to a LoggerTypeRef using AddLoggerType? IE writing my own "maxon::LoggerTypes". I could then write my own logger and deal with any passed in messages in my own custom way.
Note that I am already using loggers to log to console and to files. But now I want to log additional confidential information in some way, so need to either encrypt or somehow create my own logger (which I could then encrypt myself).
Thanks!
Kent -
hi,
not sure if I understand the question, because you are talking about some function that should have lead you to our Logger Manual.
It does explain how to create your own logger. And you already asked the question hereYou can create a Logger Type of
maxon::LoggerTypes::File()
.
When creating the logger, those flags can be used (i'll update the manual)The idea is to have the logger pointing to a maxon::Url that can be encrypted with existing alghoritm. I did gave it a try to make it work but I couldn't (maybe a limitation). I'll ask the devs if they know why it's not working or if i forgot something.
There's also the possibility to add an observer, this could help you to do some crypting operation.
Cheers,
Manuel -
Hi,
the protocol Cinema's loggers follow seems to be
maxon::LoggerTypeInterface
, but I am not quite sure if you can actually implement your own. At least there are no examples for it in the docs.But it seems somewhat unnecessary to me to actually implement your own logger (interface), since you can just send your encrypted data to one of the standard loggers. If you want things to be more convenient, you could write yourself a wrapper that wraps around one of the standard loggers and hides away the encryption stuff, so that you would only have to deal with plaintext messages.
This naive approach would be cryptographically somewhat questionable, because it would encrypt all messages individually, i.e. would not obfuscate the macro-syntax/sentence/message information. But if you would write that wrapper thingy, you could also implement a stream cipher/ one-at-a-time encryption if you were hellbent on doing so.
Cheers,
zipit -
@m_magalhaes
Hi Manuel,
Yes know the Logger Manual. But it does not tell you how to make your own version of a maxon::LoggerType::File(). It only teaches you how to log message to the existing logger types.
What I wanted to do was create a maxon::LoggerType::EncryptedFile(), but I don't see how to do this.
I also thought maybe it is possible to use the maxon::LoggerType::File and some how create my own URL handler possibly, which seems like what you tried? If you get this working then please do let me know.
The observer is what I was going to fall back on, but it kinda defeats the entire purpose. Since I have a method that I push all my log events to anyway (which then call my custom maxon logger and it nicely writes to the console and a un-encrypted file which works great). So I could just write my own file right here and be done with it. But I was really hoping I could just easily change the unencrypted file to an encrypted one and keep using the actual Maxon API itself. But I may still use the observer so I can at least learn something more about the MAXON API.
And as @zipit said I could use the existing loggers and encrypt my messages before I log them. But that means I have to then identify each message in the log file itself so that I can decrypt them (ie some start, end points, message length etc...). Do-able, but why not just have an encrypted logger type if possible, since that is effectively what you are writing anyway. So for me it is part learning the MAXON API and part coming up with the solution. And instead of wrapping I could just open my own file, add to my own file and save my own file again, removing the logger completely from the entire workflow.
Cheers,
Kent -
@kbar said in Encrypted Loggers or Custom LoggerTypes?:
But that means I have to then identify each message in the log file itself so that I can decrypt them (ie some start, end points, message length etc...).
Hm,
I might be misunderstanding something here, but I would say: If you are using a block cipher that would be true, but if you would use a stream cipher, you can decrypt per byte/character from the start of the message, no matter how the original message had been composed. In fact for the more simplistic stream ciphers where the key mutation is independent from the message, you can decrypt starting at any point in the message, you would only have to determine the offset and mutate your key/secret accordingly.
It is probably best to take the route you are most comfortable with. But for most languages there are many examples for simplistic stream ciphers using deterministic Pseudo Random Number Sequence Generators (i.e. something like a Mersenne Twister). But you should make sure that the PNG that you are going to use is behaving identical on all platforms or you gonna have a problem
That wouldn't give you any cryptographically secure results, you would have to use a more complex algorithm for that, but it should be enough to obfuscate the data against unwanted peeking
Cheers,
zipit -
@zipit Thanks for the advice. I was hoping on a quick solution from the SDK team. IE just add a flag or something quite fast to implement and get going. Unfortunately I don't have time to investigate a custom solution. Will see if Manuel comes back with something quick, otherwise I will just write to an AESFile directly myself I think and skip the loggers completely.
-
hi,
I've asked the devs. We should have everything needed to do what you want.
Encrypting file is builtin with maxon::Url scheme.
There's already several algorithm, you just have to specify your CryptoKey.When you create a logger to a file (or it could be a web server), you attach it to a maxon::Url, it should be automatically encrypted. But that's not working and that's why I've asked the devs. I don't know if it's a limitation or a bug.
What I wanted to do was create a maxon::LoggerType::EncryptedFile(), but I don't see how to do this.
as i said, the encrypted part should be done by the maxon::Url (streaming) part
Cheers,
Manuel