AnamWallet
  • Developers
    • INTRODUCE
      • Purpose of AnamWallet
      • Key Features of AnamWallet
    • ARCHITECTURE
      • Main - Module Process
      • Inter-Process Communication (IPC)
    • MODULE
      • Coinmodule Interface
      • Essential JSON-RPC Methods
      • Apply your Module with DFM
      • How to use DFM
    • ENCRYPTION MANAGEMENT
      • Hybrid Encryption System
      • KeyStore File System
    • GUIDELINE
      • Version Requirements
  • Developers - 한국어
    • INTRODUCE
      • Purpose of AnamWallet
      • Key Features of AnamWallet
    • ARCHITECTURE
      • Main - Module Process
      • Inter-Process Communication (IPC)
    • MODULE
      • BlockchainModule Interface
      • Essential JSON-RPC Methods
    • ENCRYPTION MANAGEMENT
      • Hybrid Encryption System
      • KeyStore File System
    • GUIDELINE
      • Version Requirements
  • Users
    • INTRODUCE
    • HELP
    • FAQ
  • License
Powered by GitBook
On this page
  • Main-Module Hybrid Encryption System
  • Project Overview
  • Technology Stack & Key Features
  • Communication and Encryption Flow
  • Schematic Diagram
  • Implementation Description
  1. Developers
  2. ENCRYPTION MANAGEMENT

Hybrid Encryption System

Main-Module Hybrid Encryption System

Project Overview

This project implements secure communication(share private key) between the main process and a module process using Hybrid Encryption System

We made a Hybrid Encryption System with AES and RSA to combine the speed of symmetric encryption (AES) with the security of asymmetric encryption (RSA), providing both optimal performance and security.

Technology Stack & Key Features

  • Language: Java

  • AES for symmetric encryption

  • RSA for key exchange

  • IPC(Binder) for communication between main and module

Communication and Encryption Flow

  1. The AES Key is encrypted using RSA and securely transmitted.

  2. The transmitted AES key is used for data encryption and decryption during communication.

  3. All data is encrypted with AES and transmitted through the IPC channel(Binder).

Schematic Diagram

Can make Schematic Diagram like Image

if Each Module Process generated,

Implementation Description

e.g. How to createWallet

[Wallet/UI/CreateWallet.java]

submitButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        String inputPassword = passwordEditText.getText().toString();

        /*
        TODO : 지금은 그냥 비어있는지만 테스트 하지만, 여기에 추가조건으로
         최소 몇자리 이상, 특수문자 몇개, 뭐 몇개 이런식의 조건도 걸 수 있음
         아마 정규 표현식을 사용하지 않을 까 싶음. */

        if (TextUtils.isEmpty(inputPassword)) {
            Toast.makeText(CreateWallet.this, "최소 8자 이상의 비밀번호를 입력하세요.", Toast.LENGTH_SHORT).show();
        } else {

            ethereumModuleHandler.createWallet(inputPassword);
            Toast.makeText(CreateWallet.this, "Success to Create Wallet!", Toast.LENGTH_SHORT).show();
        }
    }
});

First, input the password in UI, then call createWallet Function

[Wallet/ModuleHandler/ModuleHandler.java]

private final KeyManager walletKeyManager = new KeyManager();

public void createWallet(String password){
    if(isServiceBound) {
        try {
            String base64PubKey = walletToModule.generateRsaKeys(); // 모듈로 부터 공개키 수신
            PublicKey publicKey = KeyManager.getPublicKey(base64PubKey); // base64 -> pubkey

            walletKeyManager.createAesKey();
            String encMessage = walletKeyManager.encryptPw(password); // aes 인자들 rsa로 암호화

            walletToModule.createAccount(encMessage, walletKeyManager.encryptAESKey(publicKey), walletKeyManager.encryptIV(publicKey));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Second, Wallet calls the Module function that generateRsaKeys. At this time, the module process is alive, so the private key is also maintained according to the life cycle.

[Module/ModuleService.java]

private KeyManager keyManager = new KeyManager();

public String generateRsaKeys(){
    Log.d(TAG, getApplicationInfo().processName + ": generateRsaKeys() 실행");
    try {
        KeyManager.generateRSAKeyPair();
        return KeyManager.base64PublicKey;
    } catch(Exception e){
        e.printStackTrace();
        return "null";
    }
}

We can check in ModuleService.java

PreviousENCRYPTION MANAGEMENTNextKeyStore File System

Last updated 5 months ago