/// <summary> /// Get the Id source data from the claim /// </summary> /// <param name="claim"></param> /// <returns></returns> public byte[] GetIdSource(Claim claim) { using (MemoryStream ms = new MemoryStream()) { var bw = new CompressedBinaryWriter(ms); BuildSource(claim, bw); bw.Flush(); return(ms.ToArray()); } }
/// <summary> /// Get the Id source data from the claim /// </summary> /// <param name="claim"></param> /// <returns></returns> public byte[] GetIdSource(QueryRequest queryRequest) { using (MemoryStream ms = new MemoryStream()) { var bw = new CompressedBinaryWriter(ms); BuildSource(queryRequest, bw); bw.Flush(); return(ms.ToArray()); } }
public byte[] ToBinary() { using (MemoryStream ms = new MemoryStream()) { var bw = new CompressedBinaryWriter(ms); bw.Write(File); bw.Write(Scope); bw.Write(ServerId); bw.Flush(); return(ms.ToArray()); } }
/// <summary> /// Gets the full binary data of the claim. /// Cannot not be used for ID calculation, as it contains the proof from Issuer and subject. /// </summary> /// <param name="claim"></param> /// <returns></returns> public byte[] Serialize(QueryRequest queryRequest) { using (MemoryStream ms = new MemoryStream()) { var bw = new CompressedBinaryWriter(ms); BuildSource(queryRequest, bw); bw.Write(queryRequest.Issuer.Proof); bw.Flush(); return(((MemoryStream)bw.BaseStream).ToArray()); } }
public byte[] GetIdSource(Package package) { using (MemoryStream ms = new MemoryStream()) { var bw = new CompressedBinaryWriter(ms); bw.Write(package.Type.ToLowerSafe()); bw.Write(package.Server.Type.ToLowerSafe()); bw.Write(package.Server.Id); bw.Write(package.Server.Path); bw.Write(package.Created); //ms.WriteClaimString(package.Server.Id); // Id can always be calculated bw.Flush(); return(ms.ToArray()); } }
/// <summary> /// Gets the full binary data of the claim. /// Cannot not be used for ID calculation, as it contains the proof from Issuer and subject. /// </summary> /// <param name="claim"></param> /// <returns></returns> public byte[] Serialize(Claim claim) { using (MemoryStream ms = new MemoryStream()) { var bw = new CompressedBinaryWriter(ms); BuildSource(claim, bw); bw.Write(claim.Issuer.Proof); bw.Write(claim.Subject.Proof); bw.Write(claim.TemplateId); // ID is not added as it is dependen on the issuer/subject type foreach (var timestamp in claim.Timestamps) { // TODO: Need to add timestamps here! } bw.Flush(); return(ms.ToArray()); } }