cryptosystem.java
来自「java写的椭圆曲线加密(ECC)算法源码」· Java 代码 · 共 36 行
JAVA
36 行
package ecc;import java.io.*;/** This interface is used to model a modern cryptosystem. It contains methods to encrypt and decrypt and methods to generate keys for the specific cryptosystem.In an actual implementation it would be a good idea to initialize a key insidethe constructor method.*/public interface CryptoSystem{ /** Encrypts the string p. *@param plain the plaintext to be encrypted. *@param ek The (public) key to use for encryption. *@return the input string encrypted with the current key. */ public byte[] encrypt(byte[] plain, int numbytes, Key ek); /** Decrypts the string c. *@param cipher the ciphertext to be decrypted. *@param sk the (secret) key to use for decryption. *@return the input string decrypted with the current key. */ public byte[] decrypt(byte[] cipher, Key dk); /** This method generates a new key for the cryptosystem. *@return the new key generated*/ public Key generateKey(); /** This method returns the maximum size of blocks it can encrypt. *@return the maximum block size the system can encrypt. */ public int blockSize(); /** Returns a String describing this CryptoSystem*/ public String toString();}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?