Ejemplo n.º 1
0
    public static Shout Create(Timestamp creationTime, IMemoryOwner <byte> value, OmniDigitalSignature digitalSignature)
    {
        using var bytesPipe = new BytesPipe();
        var target = new Shout(creationTime, value, null);

        target.Export(bytesPipe.Writer, BytesPool.Shared);

        var certificate = OmniDigitalSignature.CreateOmniCertificate(digitalSignature, bytesPipe.Reader.GetSequence());

        return(new Shout(creationTime, value, certificate));
    }
Ejemplo n.º 2
0
    public static AuthenticationMessage Create(DateTime creationTime, ReadOnlyMemory <byte> hash, OmniDigitalSignature?digitalSignature)
    {
        if (digitalSignature is null)
        {
            return(new AuthenticationMessage(Timestamp.FromDateTime(creationTime), hash, null));
        }

        using var bytesPipe = new BytesPipe();
        var target = new AuthenticationMessage(Timestamp.FromDateTime(creationTime), hash, null);

        target.Export(bytesPipe.Writer, BytesPool.Shared);

        var certificate = OmniDigitalSignature.CreateOmniCertificate(digitalSignature, bytesPipe.Reader.GetSequence());

        return(new AuthenticationMessage(Timestamp.FromDateTime(creationTime), hash, certificate));
    }