Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basics of Android

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "what are the basic knowledge of Android". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Common encryption algorithm encoding

Base64

All data can be encoded into text that can be represented in only 65 characters.

The standard Base64 line is 76 characters long, with a carriage return (\r\n) at the end of each line. A carriage return character is added regardless of whether each line is 76 characters long or not.

65 characters: A~Z a~z 0~9 + / =

URL Base64 algorithm, for security reasons, will replace + with-, replace/with_

= Sometimes used ~ or. instead of

Application of Base64

Keys, ciphertext, pictures, simple encryption or pre-processing of data

Base64 encoding and decoding and btoa, atob

Hex

One of the most common representations of binary data.

It is represented by 16 characters from 0 to 9 a-f. Each hexadecimal character represents 4 bits. That is, two hexadecimal characters represent one byte.

In practical application, especially in the initialization of the key, we must distinguish which way the key is encoded, and adopt the corresponding way to analyze, in order to get the correct result.

One-way hash function (message digest algorithm)

No matter how long the plaintext is, the hashed ciphertext has a fixed length.

plaintext is different, hashing results must be different

Hashed ciphertext is irreversible

Generally used to verify data integrity, signature sign

Since the ciphertext is irreversible, the background cannot be restored, which means that if he wants to verify it, he will re-sign it in the background in the same way as the foreground. That is, he submits the source data to the background along with the signed value. So we want to make sure that the data at the time of signature is consistent with the source data submitted, and this algorithm likes to add timestamps internally.

common algorithms

MD5

SHA1

SHA256

SHA512

HmacMD5

HmacSHA1

HmacSHA256

encryption algorithm

The encryption and decryption process is reversible.

symmetric encryption algorithm

AES-128 AES-192 AES-256

AES-192 AES-256 is used in Java without policy restrictions.

Encryption/decryption using the same key

DES Data Encryption Standard

3DES TripleDES DESede

AES Advanced Encryption Standard

CryptoJS provides ECB,CBC,CFB,OFB,CTR five modes of filling provides NoPadding ZeroPadding Pkcs7(Pkcs5) Iso10126 Iso97971 AnsiX923

asymmetric encryption algorithm

Encrypted with public key, decrypted with private key

Public key is public, private key is secret

Encryption processing security, but poor performance, a single encryption length limit

RSA can be used for both data exchange and data verification

Data verification is usually combined with message digest algorithm MD5 with RSA, etc.

Common combination routine of two encryption algorithms

Random generation key

Keys are used for AES/DES/3DES encrypted data

RSA encrypts keys

Submit the encrypted key and encrypted data to the server

pkcs1padding Maximum number of bytes in plaintext is-11 bytes in ciphertext equal to key length

The maximum number of bytes in plaintext is the number of bytes in cipher key.

RSA

APK Basic Structure

lib: corresponding so files for various platforms

META-INF folder: Store some project property files

CERT.RSA: Public Key and Encryption Algorithm Description

CERT.SF: Encrypted file, which is the ciphertext information obtained after encrypting the digest plaintext with the private key. Only the public key paired with the private key can decrypt the file.

MANIFEST.MF: Program manifest file containing a summary of all files in the package in plain text

resource.arsc: resource encryption (language package) An index file for resources in the res directory, saving the contents of strings.xml and other files in the original project.

drawable: pictures

layout: layout

menu: Menu

AndriodMaintest.xml: manifest file (icon, interface, permissions, entry), basic configuration property file of Android project.

classes.dex:Java code compiled Dalvik VM directly executable files

assets: resource files (images, audio, databases, web pages, profiles, etc.)

res: Resource file, need to compile

What's the difference between res and assets?

The resource files under res directory will automatically generate index files (R.java) when compiled, and R.xxx.yyy will be used to refer to them in java code.

The resource files under asset directory do not need to generate indexes, and need to be accessed in AssetManager in java code.

Generally speaking, except audio and video resources (need to be placed under raw or asset), the resources used by Android projects developed with java will be placed under res; resources used by c++ game engines need to be placed under asset.

JVM, DVM and ART

JVM:Java virtual machine, running compiled.java files.class files

DVM: Android 4.4 and previous ones are Dalvik virtual machines. We know that Apk will compile java and other source codes into.class files through javac in the packaging process, but our Dalvik virtual machine will only execute.dex files. At this time, dx will convert.class files into.dex files executed by Dalvik virtual machines. Dalvik virtual machine will first convert the.dex file into a fast running machine code when starting, and because of the 65535 problem, we have a package integration process when the application is cold started. One of the final results is that our app starts slowly, which is the JIT feature of Dalvik virtual machine.

Dalvik is a virtual machine specially designed by Google for Android operating system. After deep optimization, although the programs on Android are developed using java, Dalvik and standard java virtual machine JVM are two different things. Dalvik VM is register-based, while JVM is stack-based;Dalvik has its own file execution format dex, and JVM executes java bytecode.

We can't see the original logic directly through Dalvik bytecode, which requires tools such as Apktool or dex2jar+jd-gui to help view, but note that eventually we need to modify the APK to operate on the.smali file, not the exported java file recompile.

ART:ART VM is an Android VM started in Android 5.0. ART VM must be compatible with Dalvik VM features, but ART has a good feature AOT (ahead of time). This feature is that when we install APK, we directly process dex into machine code that can be directly used by ART VM. ART VM converts.dex files into.oat files that can be directly run. ART VM naturally supports multiple dex, so there will be no package assembly process, so ART VM will greatly improve APP cold boot speed.

Xposed hook is Java code, so Xposed does not support 5.0 and above.

Android partition

Android usually has the following partitions (df to view partitions)

System partition: that is, we brush ROM partition

Data partition: partition is the partition where we install APK

Catch partition: Yes Cache partition

SDCard partition: is the SD card mounted.

Common directories of data partition: app, system, data, local, misc

data/data directory

Each APK pair has its own Data directory, that is, under the data/data/directory, a directory similar to Package will be generated. For example, if there is an APK whose package name is com.test.hello, there will be a com.test.hello directory under the data/data/directory. This APK can only operate on this directory, and cannot operate other APK directories.

data/app directory

The user installed APK is placed here. If we put the APK under this folder, then it is installed. This is called silent installation. Regardless of the library files in the lib directory in the APK file, the system will automatically help us put them into the call library.

data/misc directory

Save WiFi account, VPN settings, etc. For example, if you save a WIFI connection account, you can view wpa_supplicant.conf under the WIFI directory in this directory.

system partition common directory: app, lib, xbin, bin, media, framework

system/app directory

Store the APK that comes with the system. Put the APK in the System/app directory, which is also a silent installation.

system/lib directory

Store library files used by APK programs

system/bin directory and system/xbin directory

It is a shell command.

system/framework directory

Enable frameworks used by Android, such as jar files

sd card directory: /sdcard /mnt/sdcard

"What are the basics of Android" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report