List of usage examples for org.bouncycastle.cms CMSTypedData write
public void write(OutputStream out) throws IOException, CMSException;
From source file:eu.europa.ec.markt.dss.validation102853.cades.CAdESSignature.java
License:Open Source License
private byte[] getOriginalDocumentBytes() throws DSSException { final CMSTypedData signedContent = cmsSignedData.getSignedContent(); if (signedContent != null) { try {//from ww w . j av a2 s. c om final ByteArrayOutputStream originalSignedFileByteArrayOutputStream = new ByteArrayOutputStream(); signedContent.write(originalSignedFileByteArrayOutputStream); return originalSignedFileByteArrayOutputStream.toByteArray(); } catch (IOException e) { throw new DSSException(e); } catch (CMSException e) { throw new DSSException(e); } } else { if (detachedContents != null && detachedContents.size() > 0) { return detachedContents.get(0).getBytes(); } return DSSUtils.EMPTY_BYTE_ARRAY; } }