Add version attribute to the AEAD packet

This commit is contained in:
Tankred Hase 2016-03-24 10:52:34 +08:00
parent 8b46a117ab
commit c8569e0cd5

View File

@ -34,6 +34,7 @@ const IV_LEN = crypto.gcm.ivLength; // currently only AES-GCM is supported
*/ */
export default function SymEncryptedAEADProtected() { export default function SymEncryptedAEADProtected() {
this.tag = enums.packet.symEncryptedAEADProtected; this.tag = enums.packet.symEncryptedAEADProtected;
this.version = VERSION;
this.iv = null; this.iv = null;
this.encrypted = null; this.encrypted = null;
this.packets = null; this.packets = null;
@ -58,7 +59,7 @@ SymEncryptedAEADProtected.prototype.read = function (bytes) {
* @return {Uint8Array} The encrypted payload * @return {Uint8Array} The encrypted payload
*/ */
SymEncryptedAEADProtected.prototype.write = function () { SymEncryptedAEADProtected.prototype.write = function () {
return util.concatUint8Array([new Uint8Array([VERSION]), this.iv, this.encrypted]); return util.concatUint8Array([new Uint8Array([this.version]), this.iv, this.encrypted]);
}; };
/** /**