コード例 #1
0
 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;
     }
 }
コード例 #2
0
        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;
                }
                }
            }
        }
コード例 #3
0
        public static DigitallySigned ParseDigitallySignedFromBinary(InputStream inputStream)
        {
            DigitallySigned builder           = new DigitallySigned();
            int             hashAlgorithmByte = (int)ReadNumber(inputStream, 1 /* single byte */);

            DigitallySigned.Types.HashAlgorithm hashAlgorithm = (DigitallySigned.Types.HashAlgorithm)hashAlgorithmByte;

            builder.HashAlgorithm = hashAlgorithm;

            int signatureAlgorithmByte = (int)ReadNumber(inputStream, 1 /* single byte */);

            DigitallySigned.Types.SignatureAlgorithm signatureAlgorithm = (DigitallySigned.Types.SignatureAlgorithm)signatureAlgorithmByte;

            builder.SigAlgorithm = signatureAlgorithm;
            //int SignatureLength = ReadUint16(inputStream);
            byte[] signature = ReadOpaque16(inputStream);
            builder.Signature = ByteString.CopyFrom(signature);

            return(builder);
        }