All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.takamaka.wallet.TkmCypherProviderBCQTESLAPSSC1Round1 Maven / Gradle / Ivy

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package io.takamaka.wallet;

import io.takamaka.crypto.tkmsecurityprovider.util.adaptor.r1.BCQTESLAPSSC1CypherBean;
import io.takamaka.crypto.tkmsecurityprovider.util.adaptor.r1.QTR1CypherProvider;
import io.takamaka.wallet.beans.TkmCypherBean;
import org.bouncycastle.crypto.AsymmetricCipherKeyPair;

/**
 *
 * @author Giovanni Antino [email protected]
 */
public class TkmCypherProviderBCQTESLAPSSC1Round1 {

    /**
     *
     * @param keyPair is the public and private key generated by using the sign key index
     * @param message is the json format of the Internal Transaction Bean both with a generated random seed and the wallet cypher name
* Message content: : tb.getMessage() + tb.getRandomSeed() + tb.getWalletCypher().name() * @return TkmCypherBean - Java Bean Class containing the generated signature */ public static TkmCypherBean sign(AsymmetricCipherKeyPair keyPair, String message) { TkmCypherBean tcb = new TkmCypherBean(); tcb.setValid(false); BCQTESLAPSSC1CypherBean result = QTR1CypherProvider.sign(keyPair, message); tcb.setEx(result.getEx()); tcb.setSignature(result.getSignature()); tcb.setValid(result.isValid()); return tcb; } /** * * @param keyPair is the public and private key generated by using the sign key index * @param signature * @param message is the json format of the Internal Transaction Bean both with a generated random seed and the wallet cypher name
* Message content: : tb.getMessage() + tb.getRandomSeed() + tb.getWalletCypher().name() * @return TkmCypherBean */ public static TkmCypherBean verify(AsymmetricCipherKeyPair keyPair, String signature, String message) { TkmCypherBean tcb = new TkmCypherBean(); tcb.setValid(false); BCQTESLAPSSC1CypherBean result = QTR1CypherProvider.verify(keyPair, signature, message); tcb.setEx(result.getEx()); tcb.setSignature(result.getSignature()); tcb.setValid(result.isValid()); return tcb; } /** * * @param publicKey * @param signature * @param message is the json format of the Internal Transaction Bean both with a generated random seed and the wallet cypher name
* Message content: : tb.getMessage() + tb.getRandomSeed() + tb.getWalletCypher().name() * @return TkmCypherBean */ public static TkmCypherBean verify(String publicKey, String signature, String message) { TkmCypherBean tcb = new TkmCypherBean(); tcb.setValid(false); BCQTESLAPSSC1CypherBean result = QTR1CypherProvider.verify(publicKey, signature, message); tcb.setEx(result.getEx()); tcb.setSignature(result.getSignature()); tcb.setValid(result.isValid()); return tcb; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy