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

Method decryptKeyWithIES

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

Source from the content-addressed store, hash-verified

74 }
75
76 public static byte[] decryptKeyWithIES(byte[] input, long entryId,
77 PublicKey publicKey, PrivateKey privateKey)
78 throws GeneralSecurityException {
79 try {
80 // BC appears to be happier with BCECPrivateKeys:
81 privateKey = new BCECPrivateKey((ECPrivateKey) privateKey, null);
82
83 return _cryptIES(input, privateKey, false);
84 } catch (GeneralSecurityException e) {
85 log.error("Error while decrypting key", e);
86 throw new GeneralSecurityException(e);
87 }
88 }
89
90 private static byte[] _cryptIES(byte[] input, Key recipient,
91 boolean forEncryption) throws InvalidKeyException,

Callers 2

testAppMethod · 0.95
pullMethod · 0.95

Calls 1

_cryptIESMethod · 0.95

Tested by 1

testAppMethod · 0.76