Recently, I encountered an AES encryption algorithm that needs to be implemented in Java, Python, and PHP. In fact, it is not very complicated in nature, but the parameter adjustment is quite troublesome. I found some reference materials and finally got it. The actual code is as follows: Main features The three languages of JAVA, […]
Tag: pkcs
Java implements national secret SM4/ECB/PKCS7Padding symmetric encryption and decryption
Java implements national secret SM4/ECB/PKCS7Padding symmetric encryption and decryption. For the convenience of demonstration, this question uses IntelliJ IDEA 2022.1 (Community Edition) to build the code. 1. Add the required jars to the pom.xml file <?xml version=”1.0″ encoding=”UTF-8″?> <project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>SM345</artifactId> <version>1.0-SNAPSHOT</version> <properties> <maven.compiler.source>8</maven.compiler.source> <maven.compiler.target>8</maven.compiler.target> </properties> <dependencies> <!–sm3,sm4 encryption algorithm–> […]
Little knowledge of PKCS1 and PKCS8
Preface: This article is organized by the editor of Xiaochangsense.com (cha138.com), and mainly introduces the knowledge related to the small knowledge of PKCS1 and PKCS8. I hope it has certain reference value for you. Reference Technology A Recently, some friends have been confused about the difference between RSA’s private key PKCS1 and PKCS8. There will […]
Encrypted padding method (pkcs5/pkcs7/ISO10126 padding/ANSIX923 padding/Zeros padding) external padding
Due to SM2 and other encrypted grouping methods, each time the request is 16byte, it needs to be filled. The filling method is as follows: pkcs5/pkcs7/ISO10126 padding/ANSIX923 padding/Zeros padding explain: pkcs5 is a subset of pkcs7, specially used to fill 8 bytes or multiples of 8, pkcs7 can fill bytes into multiple bytes Definition of […]
AES encryption/decryption (mode CBC-data block 128 bits-filling method pkcs5padding)
unsigned char FA(unsigned char b); unsigned char FB(unsigned char b); unsigned char FC(unsigned char b); unsigned char FD(unsigned char b); unsigned char FE(unsigned char b); unsigned char Ff(unsigned char b); void Cipher(unsigned char* input, unsigned char* output, unsigned char* w);//encryption void InvCipher(unsigned char* input, unsigned char* output, unsigned char* w);//decryption static unsigned char AesSbox[16*16]= {<!– […]
Related Professional Terms of Digital Certificate (Part 1)—PKI and PKCS
1. Foreword I have been really busy recently. There is an SM2 cooperative signature algorithm that needs to be implemented in java. I have thought about this for a very, very long time, but I have almost solved this project recently, and I am waiting for the later docking. After the project is successfully completed, […]
[Solved] CAUSE: Error loading certificate PKCS12 key store mac invalid – wrong password
If your certificate is applied according to the process, such as the following process: One, install openssl 1. Download openssl window version, software download address Win32/Win64 OpenSSL Installer for Windows – Shining Light Productions If your process is correct, and the certificate and password do not match in the end, then the key point is: […]