📄 cryptosystem.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -