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

cz.abclinuxu.datoveschranky.impl.GetSignedContent Maven / Gradle / Ivy

Go to download

Library for accessing ISDS system. Supports sending, downloading, searching and verification.

The newest version!
package cz.abclinuxu.datoveschranky.impl;

import org.bouncycastle.cms.CMSException;
import org.bouncycastle.cms.CMSProcessable;
import org.bouncycastle.cms.CMSSignedData;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * Created by jludvice on 4.5.17.
 */
public class GetSignedContent {
    public static void main(String[] args) throws CMSException, IOException {
        String name = "/home/jludvice/devel/czgov/DZ-5341417.zfo";
        Path p = Paths.get(name);
        byte[] content = Files.readAllBytes(p);

        CMSSignedData data = new CMSSignedData(content);
//        verifySignature(data);
        CMSProcessable signedContent = data.getSignedContent();

       byte[] decrypted = (byte[]) signedContent.getContent();


       Files.write(Paths.get("out.xml"), decrypted);



    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy