示例#1
0
        public byte[] SignMessage(byte[] message, SignerKeyPair key)
        {
            var signedMessage = new byte[message.Length + _bytes];
            long signedMessageRealLength = 0;

            var result = PlatformInvoke32.crypto_sign(signedMessage, ref signedMessageRealLength, message, message.Length,
                key.SecretKeyBytes);

            if (result != 0) throw new CryptographicException("Failed");

            Array.Resize(ref signedMessage, (int)signedMessageRealLength);
            return signedMessage;
        }
示例#2
0
        public byte[] SignMessage(byte[] message, SignerKeyPair key)
        {
            var  signedMessage           = new byte[message.Length + _bytes];
            long signedMessageRealLength = 0;

            var result = PlatformInvoke64.crypto_sign(signedMessage, ref signedMessageRealLength, message, message.Length,
                                                      key.SecretKeyBytes);

            if (result != 0)
            {
                throw new CryptographicException("Failed");
            }

            Array.Resize(ref signedMessage, (int)signedMessageRealLength);
            return(signedMessage);
        }