public static SignedCertificateTimestamp ParseSCTFromBinary(InputStream inputStream) { SignedCertificateTimestamp sctBuilder = new SignedCertificateTimestamp(); int version = (int)ReadNumber(inputStream, 1); if (version != (int)Version.V1) { throw new SerializationException(string.Format("Unknown version: %d", version)); } sctBuilder.Version = (Version)version; _ = ReadUint16(inputStream); byte[] keyId = ReadFixedLength(inputStream, CTConstants.KeyIdLength); var id_ = new LogID(); id_.KeyId = ByteString.CopyFrom(keyId); sctBuilder.Id = id_; var timestamp = (ulong)ReadNumber(inputStream, CTConstants.TimestampLength); sctBuilder.Timestamp = timestamp; byte[] extensions = ReadVariableLength(inputStream, CTConstants.MaxExtensionsLength); sctBuilder.Extensions = ByteString.CopyFrom(extensions); sctBuilder.Signature = ParseDigitallySignedFromBinary(inputStream); return(sctBuilder); }
public void MergeFrom(SignedCertificateTimestamp other) { if (other == null) { return; } if (other.Version != 0) { Version = other.Version; } if (other.id_ != null) { if (id_ == null) { id_ = new LogID(); } Id.MergeFrom(other.Id); } if (other.Timestamp != 0UL) { Timestamp = other.Timestamp; } if (other.signature_ != null) { if (signature_ == null) { signature_ = new DigitallySigned(); } Signature.MergeFrom(other.Signature); } if (other.Extensions.Length != 0) { Extensions = other.Extensions; } }
public void MergeFrom(pb::CodedInputStream input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch (tag) { default: input.SkipLastField(); break; case 8: { version_ = (Version)input.ReadEnum(); break; } case 18: { if (id_ == null) { id_ = new LogID(); } input.ReadMessage(id_); break; } case 24: { Timestamp = input.ReadUInt64(); break; } case 34: { if (signature_ == null) { signature_ = new DigitallySigned(); } input.ReadMessage(signature_); break; } case 42: { Extensions = input.ReadBytes(); break; } } } }