Habr•December 3, 2026•🇷🇺Translated from Russian

Relatively Secure Method for Storing API Keys in Android Applications Using Native Code and JNI

Alfa-Bank engineer AlShevelev has published a detailed tutorial describing a relatively secure technique for protecting API keys inside Android applications. The approach combines native C++ code with the JNI interface to make extraction significantly harder for typical attackers.

The author notes that absolute security does not exist and that the objective is simply to increase the effort required to obtain the key. Two established methods are mentioned: storing keys in a local.properties file excluded from the repository and keeping keys inside native code called through JNI. The developer chose the second method and enhanced it by storing three separate items in native code—an encrypted API key, the encryption key, and the cryptographic algorithm itself.

To implement the solution, the project uses the NDK and CMake. A native library named native-lib is built from several C++ files including consts.cpp, crypto_alg.cpp, and facade.cpp. The consts.cpp file holds the encrypted key and encryption key as string constants and must be added to .gitignore. The cryptographic functions reside in crypto_alg.cpp, where the author selected the XXTEA algorithm for its reasonable implementation complexity, performance, and security properties.

A Kotlin class named ApiKeyExtractor declares two external native methods. The first method, encryptOrDecrypt, performs encryption or decryption when supplied with an operation identifier, source data, and key. The second method, getApiKey, retrieves the decrypted key at runtime by internally calling the native decryption routine with the constants stored in C++.

To generate the encrypted values safely, the author recommends using an instrumented unit test that temporarily holds the plaintext key and encryption key, calls the native encryption function, and allows the developer to capture the resulting ciphertext under a debugger. The captured values are then placed into consts.cpp.

The final demonstration application loads the decrypted key in MainActivity and displays it both in the log and on screen. The complete source code is available in a public repository, although the author explicitly warns that the secret-containing files should never be committed in real projects.

Related articles

Habr•Other

Wireshark 5.0.0 Released with Full Theming System, Process Attribution, and Expanded Protocol Support

Wireshark 5.0.0 has been released as the new stable branch following the 4.6.x series. The update introduces a unified theming engine that controls all interface colors and graphs through JSONC theme files, along with a built-in Theme Designer tool. New capture options in Dumpcap, TShark, and Wireshark now record process PID, name, launch time, executable path, command line, parent process, and username for each packet. Additional improvements include hierarchical configuration profiles, real-time traffic distribution statistics, packet tagging with emojis and comments, Zstandard compression for capture files, and a compact JSON output mode for TShark. The HTTP/3 dissector received major enhancements for stream following, object export, and decompression. Numerous new protocols were added and legacy interfaces were removed.

Habr•Other

Lightweight OpenVPN Web Panel on FastAPI and SQLite Manages 130 Clients with Policy-Based Routing and DNS Filtering

A developer has released an open-source lightweight web panel for OpenVPN built with FastAPI and SQLite to simplify certificate and client management beyond Easy-RSA scripts. The solution currently supports a production server handling around 130 clients with 50-60 concurrent users and monthly traffic volumes of 10-15 TB while running efficiently on a minimal 1 vCPU and 1 GB RAM VPS. Key features include policy-based routing that splits traffic between the primary gateway and a secondary WireGuard tunnel using ipset and iptables, plus integrated dnsmasq DNS filtering that blocks advertising and tracking domains to reduce background traffic by approximately 30 percent. The panel operates alongside an existing OpenVPN server configuration without requiring Docker or a separate database. It addresses limitations found in heavier existing management tools by providing flexible route control, client speed management, and local DNS blacklists and whitelists. The project is published on GitHub under the MIT license and includes details on production challenges encountered with Linux networking components.

AntiMalware•Other

AI-Built Open-Source Driver nvdriver Removes Nvidia GPU Restrictions on Linux

Developer Eric Hartford has released nvdriver, an alternative open-source kernel driver for Nvidia graphics cards on Linux. Written in Rust under the MIT license, the project uses AI tools Claude and GitHub Copilot and quickly gained over 4700 GitHub stars. nvdriver replaces only the proprietary Nvidia kernel module while retaining original user-space libraries, maintaining compatibility with CUDA, PyTorch, llama.cpp, and nvidia-smi. It enables peer-to-peer PCIe transfers between consumer GPUs, lifts NVENC session limits, allows unlicensed GRID virtualization, and unlocks compute capabilities on CMP mining cards. Testing showed a 26.8% memory bandwidth increase on Tesla V100 cards and a 12.3% boost in llama.cpp inference speed. The driver was validated on RTX 3090, RTX 4060, and mobile RTX 3050 Ti, though Maxwell and Pascal support remains unconfirmed. Users are warned of potential instability, including crashes and incorrect results during memory overclocking or large memory allocations.

Securitylab•Other

OpenAI Advances Mathematical Proof of Yang-Mills Theory Existence

OpenAI's research models have produced a formal mathematical construction proving the existence of a non-trivial quantum Yang-Mills theory in four-dimensional space-time. The work builds on Kenneth Wilson's lattice approach and satisfies key Wightman axioms, marking a major step toward solving one of the Clay Mathematics Institute's Millennium Prize Problems. A team of physicists and mathematicians led by Nobel laureate David Gross reviewed the result and confirmed its validity while noting several open questions. The construction does not yet prove the existence of a positive mass gap, the second required element for claiming the million-dollar prize. Nearly 10,000 Lean files were used to formalize the proof, allowing automated verification that took several hours. The achievement highlights how AI systems can now generate verifiable mathematical knowledge in fundamental physics.