public string Create(byte[] contents) { var id = _Signer.GetSignature(contents); var result = new StringBuilder(id.Length * 2); foreach (var i in id) { result.AppendFormat("{0:x2}", i); } return(result.ToString()); }
public async Task <byte[]> BuildAsync(TemporaryExposureKeyArgs[] keys) { var securityInfo = GetGaenSignatureInfo(); var now = _DateTimeProvider.Now(); var content = new ExposureKeySetContentArgs { Header = Header, Region = "NL", BatchNum = 1, //TODO real values? BatchSize = keys.Length, //TODO real values? SignatureInfos = new[] { securityInfo }, StartTimestamp = now.AddDays(-1).ToUnixTime(), //TODO real values? EndTimestamp = now.ToUnixTime(), //TODO real values? Keys = keys }; var contentBytes = _ContentFormatter.GetBytes(content); var signatures = new ExposureKeySetSignaturesContentArgs { Items = new[] { new ExposureKeySetSignatureContentArgs { SignatureInfo = securityInfo, Signature = _Signer.GetSignature(contentBytes), BatchSize = 1, BatchNum = 1 }, //new ExposureKeySetSignatureContentArgs //{ // //TODO The NL sig. //}, } }; return(await CreateZipArchive(contentBytes, _ContentFormatter.GetBytes(signatures))); }
public async Task <byte[]> SignedContentPacket(byte[] content) { var signature = _Signer.GetSignature(content); return(await CreateZipArchive(content, signature)); }