The objective is to encrypt a string to be displayed in a 2D barcode (PDF-417) in a manner that prevents unauthorized access to the data upon scanning. The encryption should meet specific criteria:
Block Ciphers:
Begin by selecting a symmetric key Block Cipher, such as AES 256, known for its high security.
Encryption Modes:
Utilizing a suitable Encryption Mode is crucial. Avoid ECB mode due to its vulnerability to data patterns. Consider CTR or CBC modes for better security.
Nonces and IVs:
Generate unique random Nonces (Initialization Vectors) for each encryption to prevent repetitive IV usage, which compromises security.
Hashing:
To protect against data manipulation, consider using GCM mode, which includes a hash signature to verify the integrity of the encrypted message.
Google Tink Library:
For secure and simplified implementation, leverage Google's Tink library, which offers AES-GCM encryption and manages key generation securely.
AES-GCM Mode:
Set the encryption mode to "AES/GCM/NoPadding" to benefit from its hashing and authentication features.
Key Generation:
UseTink's key generation methods instead of relying on user input (passwords) to ensure sufficient entropy and security.
Android Considerations:
Be mindful of potential reverse engineering when storing passwords in plaintext for Android apps. Consider Asymmetric Cryptography for increased security.
Following these guidelines and utilizing the Google Tink library enables you to securely encrypt strings for 2D barcodes, protecting sensitive data from unauthorized access upon scanning.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3