Search in sources :

Example 1 with SignatureAlgorithmFisteus2010

use of de.uni_koblenz.aggrimm.icp.crypto.sign.algorithm.algorithm.SignatureAlgorithmFisteus2010 in project webofneeds by researchstudio-sat.

the class WonHasher method calculateHashIdForDataset.

public String calculateHashIdForDataset(Dataset dataset) throws Exception {
    SignatureAlgorithmInterface algorithm = new SignatureAlgorithmFisteus2010();
    // signatureAlgorithmPool.borrowObject();
    try {
        GraphCollection graphCollection = ModelConverter.fromDataset(dataset);
        algorithm.canonicalize(graphCollection);
        algorithm.postCanonicalize(graphCollection);
        algorithm.hash(graphCollection, ENV_HASH_ALGORITHM);
        algorithm.postHash(graphCollection);
        graphCollection.getSignature().getDigestGen().reset();
        return hashToString(graphCollection.getSignature().getHash());
    } finally {
        if (algorithm != null) {
        // signatureAlgorithmPool.returnObject(algorithm);
        }
    }
}
Also used : GraphCollection(de.uni_koblenz.aggrimm.icp.crypto.sign.graph.GraphCollection) SignatureAlgorithmInterface(de.uni_koblenz.aggrimm.icp.crypto.sign.algorithm.SignatureAlgorithmInterface) SignatureAlgorithmFisteus2010(de.uni_koblenz.aggrimm.icp.crypto.sign.algorithm.algorithm.SignatureAlgorithmFisteus2010)

Example 2 with SignatureAlgorithmFisteus2010

use of de.uni_koblenz.aggrimm.icp.crypto.sign.algorithm.algorithm.SignatureAlgorithmFisteus2010 in project webofneeds by researchstudio-sat.

the class WonHasher method hashNamedGraphForSigning.

/**
 * Calculates the hash of the one named graph contained in the specified
 * GraphCollection
 *
 * @param inputWithOneNamedGraph
 * @return the SignatureData object that holds the hash
 * @throws Exception
 */
public SignatureData hashNamedGraphForSigning(final GraphCollection inputWithOneNamedGraph) throws Exception {
    SignatureAlgorithmInterface algorithm = new SignatureAlgorithmFisteus2010();
    // signatureAlgorithmPool.borrowObject();
    try {
        algorithm.canonicalize(inputWithOneNamedGraph);
        algorithm.postCanonicalize(inputWithOneNamedGraph);
        algorithm.hash(inputWithOneNamedGraph, ENV_HASH_ALGORITHM);
        algorithm.postHash(inputWithOneNamedGraph);
        inputWithOneNamedGraph.getSignature().getDigestGen().reset();
        return inputWithOneNamedGraph.getSignature();
    } finally {
        if (algorithm != null) {
        // signatureAlgorithmPool.returnObject(algorithm);
        }
    }
}
Also used : SignatureAlgorithmInterface(de.uni_koblenz.aggrimm.icp.crypto.sign.algorithm.SignatureAlgorithmInterface) SignatureAlgorithmFisteus2010(de.uni_koblenz.aggrimm.icp.crypto.sign.algorithm.algorithm.SignatureAlgorithmFisteus2010)

Aggregations

SignatureAlgorithmInterface (de.uni_koblenz.aggrimm.icp.crypto.sign.algorithm.SignatureAlgorithmInterface)2 SignatureAlgorithmFisteus2010 (de.uni_koblenz.aggrimm.icp.crypto.sign.algorithm.algorithm.SignatureAlgorithmFisteus2010)2 GraphCollection (de.uni_koblenz.aggrimm.icp.crypto.sign.graph.GraphCollection)1