MCPcopy Create free account
hub / github.com/TrsstProject/trsst / _cryptIES

Method _cryptIES

src/main/java/com/trsst/Crypto.java:90–102  ·  view source on GitHub ↗
(byte[] input, Key recipient,
            boolean forEncryption)

Source from the content-addressed store, hash-verified

88 }
89
90 private static byte[] _cryptIES(byte[] input, Key recipient,
91 boolean forEncryption) throws InvalidKeyException,
92 IllegalBlockSizeException, BadPaddingException {
93 IESCipher cipher = new IESCipher(new IESEngine(
94 new ECDHBasicAgreement(), new KDF2BytesGenerator(
95 new SHA1Digest()), new HMac(new SHA256Digest()),
96 new PaddedBufferedBlockCipher(new CBCBlockCipher(
97 new AESEngine()))));
98
99 cipher.engineInit(forEncryption ? Cipher.ENCRYPT_MODE
100 : Cipher.DECRYPT_MODE, recipient, new SecureRandom());
101 return cipher.engineDoFinal(input, 0, input.length);
102 }
103
104 public static byte[] generateAESKey() {
105 byte[] result = new byte[32];

Callers 2

encryptKeyWithIESMethod · 0.95
decryptKeyWithIESMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected