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

Method encryptElementAES

src/main/java/com/trsst/client/Client.java:902–915  ·  view source on GitHub ↗
(Element element, byte[] secretKey)

Source from the content-addressed store, hash-verified

900 }
901
902 public static byte[] encryptElementAES(Element element, byte[] secretKey)
903 throws SecurityException {
904 byte[] after = null;
905 try {
906 ByteArrayOutputStream output = new ByteArrayOutputStream();
907 element.writeTo(output);
908 byte[] before = output.toByteArray();
909 after = Crypto.encryptAES(before, secretKey);
910 } catch (Exception e) {
911 log.error("Error while encrypting element", e);
912 throw new SecurityException(e);
913 }
914 return after;
915 }
916
917 public static Element decryptElementAES(byte[] data, byte[] secretKey)
918 throws SecurityException {

Callers 2

testAppMethod · 0.95
postMethod · 0.95

Calls 2

encryptAESMethod · 0.95
writeToMethod · 0.80

Tested by 1

testAppMethod · 0.76