Ejemplo n.º 1
0
        public Task Upload(Signature targetSignature, CommentContent comment, AgreementPublicKey agreementPublicKey, DigitalSignature digitalSignature, CancellationToken token)
        {
            if (targetSignature == null)
            {
                throw new ArgumentNullException(nameof(targetSignature));
            }
            if (comment == null)
            {
                throw new ArgumentNullException(nameof(comment));
            }
            if (digitalSignature == null)
            {
                throw new ArgumentNullException(nameof(digitalSignature));
            }

            return(_coreManager.VolatileSetStream(ContentConverter.ToCryptoStream(comment, 1024 * 256, agreementPublicKey, 0), TimeSpan.FromDays(360), token)
                   .ContinueWith(task =>
            {
                _coreManager.UploadMetadata(new UnicastClue("MailMessage", targetSignature, DateTime.UtcNow, task.Result, digitalSignature));
            }));
        }
Ejemplo n.º 2
0
            public static Stream ToCryptoStream <T>(T message, int paddingSize, AgreementPublicKey publicKey, int version)
                where T : MessageBase <T>
            {
                if (message == null)
                {
                    throw new ArgumentNullException(nameof(message));
                }
                if (publicKey == null)
                {
                    throw new ArgumentNullException(nameof(publicKey));
                }

                try
                {
                    throw new NotImplementedException();
                    //return AddVersion(AddHash(Encrypt(AddPadding(Compress(message.Export(_bufferManager)), paddingSize), publicKey)), version);
                }
                catch (Exception e)
                {
                    Log.Debug(e);

                    return(null);
                }
            }
Ejemplo n.º 3
0
        public Task SetUnicastCommentMessage(Signature targetSignature, CommentContent comment, AgreementPublicKey agreementPublicKey, DigitalSignature digitalSignature, CancellationToken token)
        {
            this.Check();

            lock (_lockObject)
            {
                return(Task.Run(() =>
                {
                    this.Action(AmoebaFunctionType.SetUnicastCommentMessage, (targetSignature, comment, agreementPublicKey, digitalSignature), token);
                }));
            }
        }
Ejemplo n.º 4
0
        public Task SetUnicastCommentMessage(Signature targetSignature, CommentContent comment, AgreementPublicKey agreementPublicKey, DigitalSignature digitalSignature, CancellationToken token)
        {
            this.Check();

            lock (_lockObject)
            {
                return(_messageManager.Upload(targetSignature, comment, agreementPublicKey, digitalSignature, token));
            }
        }