I have text generated by a C# application that I need to read into an OA script. It's working fine, but I don't want to be transferring plain text.
It looks simple enough to encrypt/decrypt strings in OA using aes256Encrypt/Decrypt, but I don't know if it's possible to replicate those functions in Windows. The AES engine in C# seems to need more parameters than a single text key, and I'm lost. Is there a way to emulate the OA AES encryption in Windows, or any other standard shared encryption method?
Thanks!
Transferring encrypted data between OA and Windows
- iain
- Posts:33
- Joined: Fri May 19, 2017 7:08 pm
Transferring encrypted data between OA and Windows
- kilianvp
- Posts:443
- Joined: Fri Jan 16, 2015 10:29 am
Re: Transferring encrypted data between OA and Windows
Yes for C# use a 32 bytes long String UTF-8 Key and as IV empty 16 bytes (new byte[16]), the mode is CipherMode.CBC and Padding is PaddingMode.Zeros
Use the same key for aes256Encrypt/Decrypt. If you use a longer key for WinCC OA, it will be truncated at 32 bytes. You can use Array.Resize to truncated at 32 bytes.
Use the same key for aes256Encrypt/Decrypt. If you use a longer key for WinCC OA, it will be truncated at 32 bytes. You can use Array.Resize to truncated at 32 bytes.
- iain
- Posts:33
- Joined: Fri May 19, 2017 7:08 pm
Re: Transferring encrypted data between OA and Windows
Excellent! Thank you.