MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / aesGCM

Method aesGCM

src/main/java/core/packetproxy/quic/value/key/Key.java:70–78  ·  view source on GitHub ↗
(int cipherMode, byte[] packetNumber, byte[] payload, byte[] associatedData)

Source from the content-addressed store, hash-verified

68 }
69
70 public byte[] aesGCM(int cipherMode, byte[] packetNumber, byte[] payload, byte[] associatedData) throws Exception {
71 byte[] nonce = getNonce(packetNumber);
72 SecretKeySpec keySpec = new SecretKeySpec(this.key, "AES");
73 Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
74 GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(128, nonce);
75 cipher.init(cipherMode, keySpec, gcmParameterSpec);
76 cipher.updateAAD(associatedData);
77 return cipher.doFinal(payload);
78 }
79
80 public byte[] decryptPayload(byte[] packetNumber, byte[] encryptPayload, byte[] associatedData) throws Exception {
81 return aesGCM(Cipher.DECRYPT_MODE, packetNumber, encryptPayload, associatedData);

Callers 2

decryptPayloadMethod · 0.95
encryptPayloadMethod · 0.95

Calls 3

getNonceMethod · 0.95
getInstanceMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected