Coder Social home page Coder Social logo

unsealed-secrets's Introduction

unsealed-secrets

A guide to public key encryption in multiple languages.

Remember to create your own keys when using the examples, see _shared/create_new_key_pair.sh for help or just run it.

While use public encryption will create seemingly random and different output each time you use it, you still need to protect against unauthorized reusage of a valid and authorized request. My suggestion is to add a timestamp to every request and validate that timestamp against the current time.

All examples will take an arbitrary string and convert into a json string with a payload and token key both with the base64 encoded bytes from the encryption.

PHP

php -f php/encode.php _shared/payload.json sealed.json
php -f php/decode.php sealed.json

Python

python python/encode.py _shared/payload.json sealed.json
python python/decode.py sealed.json

Ruby

ruby ruby/encode.rb _shared/payload.json sealed.json
ruby ruby/decode.rb sealed.json

Android

Run/See the ExampleTest unit tests.

iOS

Prepare the project by installing pods

pod install

Open the workspace and run/see the unit tests.

C# / Mono

mcs csharp/encode.cs && mono csharp/encode.exe _shared/payload.json sealed.json
mcs /reference:System.Web.Extensions.dll csharp/decode.cs && mono csharp/decode.exe sealed.json

unsealed-secrets's People

Contributors

codereaper avatar jjetrifork avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

unsealed-secrets's Issues

i dont get how to use this

i run this:

sh create_new_key_pair.sh
Generating RSA private key, 2048 bit long modulus
...................................................................................................................+++
.................................+++
e is 65537 (0x10001)
writing RSA key
writing RSA key
Signature ok
subject=/CN=www.example.com/O=Example LTD./C=US
Getting Private key

and open encode.php and decode.php on the browser but nothing happen

decode:

sealed.json

encode:

payload.json sealed.json

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.