Prototype
Prototype Overview
The prototype is a Java application designed to test and demonstrate the functionality of interacting with the Android implementation of the Crypto-Abstraction-Layer. This layer provides a unified interface for cryptographic operations, abstracting the underlying complexities of different cryptographic algorithms and hardware implementations.
Prototype Functionality
- Key Generation: The creation of cryptographic keys for various algorithms.
- Symmetric and Asymmetric Encryption of Text and Images: Encrypting data using both symmetric (e.g., AES) and asymmetric (e.g., RSA) algorithms.
- Symmetric and Asymmetric Decryption of Text and Images: Decrypting data that was encrypted using symmetric and asymmetric algorithms.
- Signing Encrypted Bytes: Generating digital signatures for encrypted data to ensure authenticity and integrity.
- Verification of Signatures: Verifying the authenticity of digital signatures to confirm the integrity of the data.
Prototype UI
Key Generation Process
- The user specifies the algorithm, padding, and purposes for the key.
- The user clicks a button to generate the key.
- The Java application sends this instruction to the library.
- The library requests the Keystore to generate a key on the device’s Secure Element.
Encryption Process
- After the key is generated, the user selects a file to encrypt.
- The Java application sends the file bytes to the library.
- The library uses the generated key to encrypt the data.
- The library sends the encrypted bytes back to the Java application.
Sequence Diagram
sequenceDiagram
participant Storage
participant Application
participant RustLibrary
participant AndroidKeystoreAPI
participant SecureElement
Application->>RustLibrary: Generate Key Request
alt Secure Element Available
RustLibrary->>AndroidKeystoreAPI: Request Key (via Keystore API)
AndroidKeystoreAPI->>SecureElement: Request Key Generation
SecureElement->>SecureElement: Store Generated Key
SecureElement->>AndroidKeystoreAPI: Key Generated
AndroidKeystoreAPI->>RustLibrary: Key Generated
RustLibrary->>Application: Key Generated
else Secure Element Not Available
RustLibrary->>AndroidKeystoreAPI: Request Key (via Keystore API)
AndroidKeystoreAPI->>RustLibrary: Error (No Secure Element)
RustLibrary->>Application: Error (No Secure Element)
end
Application->>RustLibrary: File to Encrypt (Bytes)
RustLibrary->>AndroidKeystoreAPI: Encrypt using Generated Key (via Keystore API)
AndroidKeystoreAPI->>SecureElement: Encrypt using Generated Key
SecureElement->>AndroidKeystoreAPI: Encrypted Bytes
AndroidKeystoreAPI->>RustLibrary: Encrypted Bytes
RustLibrary->>Application: Encrypted File
Application->>Storage: Save File to Storage
Decryption, signing, and verification follow a similar process to encryption.
This post is licensed under CC BY 4.0 by the author.