<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ECB on seth-shi</title><link>https://sethix.com/tags/ecb/</link><description>Recent content in ECB on seth-shi</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Tue, 11 May 2021 12:41:39 +0800</lastBuildDate><atom:link href="https://sethix.com/tags/ecb/index.xml" rel="self" type="application/rss+xml"/><item><title>Cross-Service Data Verification Using AES Algorithm</title><link>https://sethix.com/posts/2021051112/</link><pubDate>Tue, 11 May 2021 12:41:39 +0800</pubDate><guid>https://sethix.com/posts/2021051112/</guid><description>Recently while working on an advertising service that requires cross-application data transmission between backend services (PHP + Go), we chose symmetric encryption for implementation.
Common Pitfalls Key Length Errors may occur if using a 32-bit key (since documentation states valid lengths are 16, 24, 32)
AES-128: Requires 16-byte key
AES-192: Requires 24-byte key
AES-256: Requires 32-byte key
Always match key length to the selected algorithm.
Padding Algorithm Easily overlooked in PHP due to simple usage: $text = &amp;#34;String to encrypt&amp;#34;; // Key length must match algorithm requirements $key = &amp;#34;2bfbd593bb32b2b9&amp;#34;; // AES-128-ECB depends on chosen algorithm openssl_encrypt($text, &amp;#39;AES-128-ECB&amp;#39;, $key); The above produces base64-encoded output by default.</description></item></channel></rss>