Ejemplo n.º 1
0
        public static bool TryParse(MemoryCursor cursor, out CertificateVerify result)
        {
            result = new CertificateVerify();

            if (!HandshakeType.TrySlice(cursor, HandshakeType.CertificateVerify))
            {
                return(false);
            }

            var body = HandshakeLength.SliceBytes(cursor);

            using var bodyContext = body.SetCursor(cursor);

            var scheme    = SignatureScheme.Parse(cursor);
            var signature = ByteVector.SliceVectorBytes(cursor, 0..ushort.MaxValue);

            if (!cursor.IsEnd())
            {
                throw new EncodingException();
            }

            result = new CertificateVerify(scheme, signature);

            return(true);
        }
Ejemplo n.º 2
0
 private CertificateVerify(SignatureScheme scheme, MemoryBuffer signature)
 {
     Scheme    = scheme;
     Signature = signature;
 }
Ejemplo n.º 3
0
        public static CursorHandshakeWritingContext StartWriting(MemoryCursor cursor, SignatureScheme scheme)
        {
            HandshakeType.CertificateVerify.WriteBytes(cursor);

            var payloadContext = HandshakeLength.StartWriting(cursor);

            scheme.WriteBytes(cursor);

            var signatureContext = ByteVector.StartVectorWriting(cursor, 0..ushort.MaxValue);

            return(new CursorHandshakeWritingContext(payloadContext, signatureContext));
        }