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

Method encryptKeyWithIES

src/main/java/com/trsst/Crypto.java:61–74  ·  view source on GitHub ↗
(byte[] input, long entryId,
            PublicKey publicKey, PrivateKey privateKey)

Source from the content-addressed store, hash-verified

59public class Crypto {
60
61 public static byte[] encryptKeyWithIES(byte[] input, long entryId,
62 PublicKey publicKey, PrivateKey privateKey)
63 throws GeneralSecurityException {
64 try {
65 // BC appears to be happier with BCECPublicKeys:
66 // see BC's IESCipher.engineInit's check for ECPublicKey
67 publicKey = new BCECPublicKey((ECPublicKey) publicKey, null);
68
69 return _cryptIES(input, publicKey, true);
70 } catch (GeneralSecurityException e) {
71 log.error("Error while encrypting key", e);
72 throw e;
73 }
74 }
75
76 public static byte[] decryptKeyWithIES(byte[] input, long entryId,
77 PublicKey publicKey, PrivateKey privateKey)

Callers 2

testAppMethod · 0.95
postMethod · 0.95

Calls 1

_cryptIESMethod · 0.95

Tested by 1

testAppMethod · 0.76