Coder Social home page Coder Social logo

sts's Introduction

STS - Simple Text Signing library

STS started as a fork of slm4j. It is now rewritten in Scala, has a new API and the "license" part has been removed: the intended purpose of STS is simply to sign text and verify a signed text, regardless of what the text is.

The signing uses the DSA algorithm.

Building

Build the library using SBT:

$ sbt compile
$ sbt package

Command line tool

First, create the wrapper script bin/sts.sh with SBT by issuing command sbt mksh.

Get usage help with option --help:

$ bin/sts.sh --help

To create a private/public key pair in files test1 and test1.pub, respectively:

$ bin/sts.sh genkeys --base-name test1

To sign file unsigned.txt using private key test1 and write the result to signed.txt.

$ bin/sts.sh sign --private-key test1 --input unsigned.txt --output signed.txt

To verify that signed file signed.txt is valid (i.e., has not been tampered with):

$ bin/sts.sh verify --public-key test1.pub --input signed.txt
Signed text is valid.
$ echo $?
0

Let's check what happens if we modify a signed file:

$ cp signed.txt tamperedWith.txt
$ vim tamperedWith.txt
$ bin/sts.sh verify --public-key test1.pub --input tamperedWith.txt
Signed text is NOT valid.
$ echo $?
2

Example signed file

As an example, here's a file that was signed by STS:

----- BEGIN TEXT -----
RegistredTo=John Smith
ExpirationDate=20090630
Version=Full
----- END TEXT -----
----- BEGIN SIGNATURE -----
MCwCFCKRoTnYFdE7JJzH
W2XQddSq9wqCR43hRQ+J
BZV5FS+ZU5j90JAZFUA2
WQ==
----- END SIGNATURE -----

Note that STS imposes no restrictions on the text except that it must not contain any line starting with the delimiter marker -----.

Any changes to the text (or the signature) and the validator will consider the file invalid.

STS on GitHub.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.