コード例 #1
0
        public byte[] ToByteArray()
        {
            using (var ms = new MemoryStream())
            {
                using (var writer = new BinaryWriter(ms))
                {
                    writer.Write(RpIdHash);

                    writer.Write((byte)_flags);

                    var signCount = BitConverter.GetBytes(SignCount);
                    if (BitConverter.IsLittleEndian)
                    {
                        Array.Reverse(signCount);
                    }
                    writer.Write(signCount);

                    if (HasAttestedCredentialData)
                    {
                        writer.Write(AttestedCredentialData.ToByteArray());
                    }

                    if (HasExtensionsData)
                    {
                        writer.Write(Extensions.GetBytes());
                    }
                }
                return(ms.ToArray());
            }
        }
コード例 #2
0
        public byte[] ToByteArray()
        {
            using var ms = new MemoryStream();

            using (var writer = new BinaryWriter(ms))
            {
                writer.Write(RpIdHash);

                writer.Write((byte)_flags);

                writer.WriteUInt32BigEndian(SignCount);

                if (HasAttestedCredentialData)
                {
                    writer.Write(AttestedCredentialData.ToByteArray());
                }

                if (HasExtensionsData)
                {
                    writer.Write(Extensions.GetBytes());
                }
            }

            return(ms.ToArray());
        }