
cz.abclinuxu.datoveschranky.impl.GetSignedContent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of isds Show documentation
Show all versions of isds Show documentation
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