Asp.net and java are used to encrypt and decrypt des, asp. netjavades
Recently, a new project was developed in java. The old project is asp.net, and the interface transmission requires des encryption and decryption. I checked some information on the Internet and most of the information can't be used, after debugging and processing, the specific code is as follows:
The key must be 8 bits.
///
The corresponding java method is as follows:
Package com. testspring;
Import javax. crypto.
Python and Java for DES encryption and decryption instances, pythondes
DES is the abbreviation of Data Encryption Standard (Data Encryption Standard). It is a common symmetric Encryption algorithm. This article does not describe the features and application scenarios of symmetric encryption and asymmetric encryption. You can google it on your own. This article describes how to use Java and Python to encrypt and decrypt DES.
This is the most recent application scenario. We need to connect to a sy
encryption and decryption of JAVA and PHP. After finding information from multiple parties and researching it, we found a general basic encryption and decryption solution as follows:
1: JAVA code (3DES)
Import javax. crypto. Cipher;
Import javax. crypto. SecretKey;
Import javax. crypto. spec. SecretKeySpec;
Import org. apache. log4j. Logger;
Import sun. misc. BASE64Decoder;
Import sun. misc. BASE64Encoder;
/**
* Java 3DES encryption and decryption, a
RC4 is a symmetric cipher algorithm, which belongs to a sequence cipher (Streamcipher, also known as a stream password) in a symmetric cipher algorithm, which is a variable key length and a stream password oriented to byte operations .RC4 is one of the stream cipher Streamcipher, which is a sequence
as follows:
Use Keygenerator to create a symmetric key that is stored in the KeyStore.
Set KeyGenParameterSpec.Builder.setUserAuthenticationRequired () to True,Initializes a cipher object using the created symmetric key and invokes the Fingerprintmanager.authenticate () method to start the fingerprint sensor and start listening.
Rewrite several callback methods for Fingerprintmanager.authenticationcallback to handle the success of fingerprint reco
, etc.
The realization of symmetric encryption for fingerprint identification
The main process for using fingerprint-aware symmetric encryption is as follows:
Use Keygenerator to create a symmetric key that is stored in the KeyStore.
Set KeyGenParameterSpec.Builder.setUserAuthenticationRequired () to True,
Initializes a cipher object using the created symmetric key and invokes the Fingerprintmanager.authenticate () method to start the f
the Java classes involved in DES encryption decryption
Cipher
This class provides password functionality for encryption and decryption. It forms the core of the Java cryptographic Extension (JCE) framework .To create the Cipher object, the application invokes the Cipher getinstance method and passes the name of the requested transformation to it. You can also s
Introduction
rsa cryptosystem is a public key cryptosystem which is proposed earlier. In 1978, Rivest,shamir and Adleman of the Massachusetts Institute of MIT (MIT) presented an asymmetric (public key) cryptosystem based on number theory, called the RSA Cryptosystem, in a paper entitled "Methods for obtaining digital signatures and public key cryptography". RSA is a kind of block cipher system, which is based on the "large integer element factorizati
A common term for passwordsPlainText: Information to encryptCiphertext: PlainText after being encryptedEncryption: The process of converting plaintext into ciphertextEncryption algorithm: conversion algorithm of plaintext to ciphertextCryptographic keys: Secret keys for cryptographic operations through cryptographic algorithmsDecryption: The process of converting ciphertext to plaintextDecryption algorithm: An algorithm for converting ciphertext to plaintextDecryption key: The secret key of decr
/*
Name: Heman encoding (priority queue implementation)
Copyright:
Author: self-defeating
Date: 28/09/14
Description:
A common Linear table is transformed into a Heman tree by using the priority queue, and then carried out the Heman encoding to obtain a cipher book that simultaneously records the plaintext and the corresponding encoding.
Using the priority queue (minimum heap) to construct a Heman tree is an efficient method, which is much faster than
of the key fileByte rawkeydata [] = fileutil. readfile (Key filename );// Create an eyspec object from the original key dataDeskeyspec DKS = new deskeyspec (rawkeydata );// Create a key factory and use it to convert the keyspec into a secret key objectSecretkeyfactory key factory = secretkeyfactory. getinstance ("des ");Secret Key key = keyfactory. generatesecret (DKS );// The cipher object actually completes the encryption operationCipher
For example, there is a 21-bit byte array which is divided into three blocks. If there are not enough 8 bytes, add 0x00 and perform DES encryption on the three blocks:
The encrypted three pieces of data are the data encrypted by the ECB.
JavaCodeImplementation:
Public static byte [] des3encodeecb (byte [] key, byte [] data) throws exception {secretkey secret ey = new secretkeyspec (key, "desede"); cipher = ci
, TLS, electronic certificates, electronic signatures, electronic IDs, etc.
Symmetric encryption implementation of fingerprint recognitionThe main process for using fingerprint-aware symmetric encryption is as follows:
Use keygenerator to create a symmetric key that is stored in the KeyStore.
Set KeyGenParameterSpec.Builder.setUserAuthenticationRequired() to True,
Initializes a cipher object with the created symmetric key, and us
policies, administrative tools----"System cryptography: Using FIPS compliant algorithms for encryption, hashing, and signing" options, right-click Properties, under Local security settings, Select "Enabled (E)" and click "Apply", "OK". 2 is shown below:Figure 2 Enabling FIPS2) Disable SSL cipher SuiteOperation steps: Press 'Win + R', go to "run", type "gpedit.msc", open "local Group Policy Editor", Computer Configuration, network->ssl configuration s
();
}
/**
* Convert the hexadecimal value string to a byte array and public static string bytearr2hexstr (byte [] arrb)
* Reversible conversion process
*
* @ Param strin
* String to be converted
* @ Return: converted byte array
* @ Throws exception
* This method does not handle any exceptions. All exceptions are thrown.
*
*/
Private Static byte [] hexstr2bytearr (string strin) throws exception {
Byte [] arrb = strin. getbytes ();
Int ilen = arrb. length;
// Two characters indicate one byte, s
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.