Giter Site home page Giter Site logo

opencanarias / taple-core Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 5.0 1.14 MB

Reference library that implements all the necessary functionality for developing a client that is compatible with TAPLE's DLT network.

Home Page: https://www.taple.es

License: GNU Affero General Public License v3.0

Rust 100.00%
blockchain sustainability taple distributed-ledger

taple-core's Introduction

TAPLE Core

TAPLE (pronounced T+🍎 ['tapəl]) stands for Tracking (Autonomous) of Provenance and Lifecycle Events. TAPLE is a permissioned DLT solution for traceability of assets and processes. It is:

  • Scalable: Scaling to a sufficient level for traceability use cases.
  • Light: Designed to support resource constrained devices.
  • Flexible: Have a flexible and adaptable cryptographic scheme mechanism for a multitude of scenarios.
  • Energy-efficient: Rust powered, TAPLE is sustainable and efficient from the point of view of energy consumption.

TAPLE Core is the reference library that implements all the necessary functionality for developing a client that is compatible with TAPLE's DLT network. If you need a client, refer to our TAPLE Client.

AGPL licensed

Discover | Learn | Build | Code

Build

Minimium supported rust versión (MSRV) is 1.67.

A basic usage example can be found at examples directory. You can find more information about TAPLE technology and how to develop for TAPLE on TAPLE Website.

License

This project is licensed under the AGPL license.

taple-core's People

Contributors

florentinpg avatar edusu avatar padinsky avatar eduardoeb3 avatar fperez-opencanarias avatar javierduquemelguizo avatar

Stargazers

Daniel Mantei avatar Alejandro Alfonso Fernández avatar Antonio Estevez avatar  avatar  avatar mariodev avatar  avatar PassageMaker4281 avatar  avatar Yeray Rodriguez avatar sfter avatar II-II avatar Ruben Santibañez Acosta avatar Pablo Molina Martinez avatar  avatar Carlos Domínguez García avatar TierraLibre avatar  avatar Pablo Molina avatar

Watchers

James Cloos avatar  avatar

taple-core's Issues

fix: protect cryptographic material in memory

This fix proposes changing the BaseKeyPair object so that instead of having an option to the PrivateKey, it has as an option an encryptor object that encrypts the secret key in memory when creating the key pair and decrypts it on demand when signing is needed.
We can use the memsec crate, which implements the same functions as the OpenSSH libsodium library, and enforce our encryptor based on an efficient symmetric algorithm (with chacha20poly1305), or use the memsecurity crate that has already implemented it. I attach a proof of concept with memsecurity.

Example BaseKeyPair:

use memsecurity::EncryptedMem;

/// Base key pair.
///
/// This type contains the public key and some `EncryptedMem` object with the
/// secret key or none.
///
pub struct BaseKeyPair<K> {
    pub public: K,
    pub secret: Option<EncryptedMem>,
}

Example type ed25519:

/// Ed25519 key pair.
pub type Ed25519KeyPair = BaseKeyPair<VerifyingKey>;

Example build from secret bytes:

    fn from_secret(secret: &[u8]) -> Result<Self, Error>
    where
        Self: Sized,
    {
        let mut encrytion = EncryptedMem::new();
        let sk = SigningKey::try_from(secret)
            .map_err(|_| Error::KeyPair("Ed25519".to_owned(), "geting SigningKey".to_owned()))?;
        let public_key = VerifyingKey::from(&sk);
        encrytion
            .encrypt(&sk.to_bytes())
            .map_err(|_| Error::KeyPair("Ed25519".to_owned(), "mem encryption".to_owned()))?;
        Ok(Ed25519KeyPair {
            public: public_key,
            secret: Some(encrytion),
        })
    }

Example sign:

    fn sign(&mut self, message: &[u8]) -> Result<Vec<u8>, Error> {
        let encr = self.secret.as_ref().ok_or(Error::KeyPair(
            "Ed25519".to_owned(),
            "secret not found".to_owned(),
        ))?;
        let sk = encr
            .decrypt()
            .map_err(|_| Error::KeyPair("Ed25519".to_owned(), "mem decryption".to_owned()))?;

        let signing_key = SigningKey::try_from(sk.as_ref()).map_err(|_| {
            Error::KeyPair("Ed25519".to_owned(), "SigningKey from slice".to_owned())
        })?;
        let signature = signing_key.sign(message);
        Ok(signature.to_bytes().to_vec())
    }
}

The verification would remain the same as before.

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.