public CMSEncryptedData(ContentInfo contentInfo) { this.contentInfo = contentInfo; this.encryptedData = EncryptedData.getInstance(contentInfo.getContent()); }
private void initialize(ContentInfo contentInfo) { this.contentInfo = contentInfo; if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType())) { this.timeStampedData = TimeStampedData.getInstance(contentInfo.getContent()); } else { throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId()); } util = new TimeStampDataUtil(this.timeStampedData); }
public CMSEncryptedData(ContentInfo contentInfo) { this.contentInfo = contentInfo; this.encryptedData = EncryptedData.getInstance(contentInfo.getContent()); }
private void initialize(ContentInfo contentInfo) { this.contentInfo = contentInfo; if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType())) { this.timeStampedData = TimeStampedData.getInstance(contentInfo.getContent()); } else { throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId()); } util = new TimeStampDataUtil(this.timeStampedData); }
/** * Constructs DVCRequest from CMS SignedData object. * * @param signedData the CMS SignedData object containing the request * @throws DVCSConstructionException */ public DVCSRequest(CMSSignedData signedData) throws DVCSConstructionException { this(SignedData.getInstance(signedData.toASN1Structure().getContent()).getEncapContentInfo()); }
/** * Constructs DVCRequest from CMS SignedData object. * * @param signedData the CMS SignedData object containing the request * @throws org.spongycastle.dvcs.DVCSConstructionException */ public DVCSResponse(CMSSignedData signedData) throws DVCSConstructionException { this(SignedData.getInstance(signedData.toASN1Structure().getContent()).getEncapContentInfo()); }
/** * Constructs DVCRequest from CMS SignedData object. * * @param signedData the CMS SignedData object containing the request * @throws DVCSConstructionException */ public DVCSRequest(CMSSignedData signedData) throws DVCSConstructionException { this(SignedData.getInstance(signedData.toASN1Structure().getContent()).getEncapContentInfo()); }
/** * Return if this is object represents a detached signature. * * @return true if this message represents a detached signature, false otherwise. */ public boolean isDetachedSignature() { return signedData.getEncapContentInfo().getContent() == null && signedData.getSignerInfos().size() > 0; }
/** * Return if this is object represents a certificate management message. * * @return true if the message has no signers or content, false otherwise. */ public boolean isCertificateManagementMessage() { return signedData.getEncapContentInfo().getContent() == null && signedData.getSignerInfos().size() == 0; }
/** * Return if this is object represents a certificate management message. * * @return true if the message has no signers or content, false otherwise. */ public boolean isCertificateManagementMessage() { return signedData.getEncapContentInfo().getContent() == null && signedData.getSignerInfos().size() == 0; }
/** * Return if this is object represents a detached signature. * * @return true if this message represents a detached signature, false otherwise. */ public boolean isDetachedSignature() { return signedData.getEncapContentInfo().getContent() == null && signedData.getSignerInfos().size() > 0; }
/** * Constructs DVCResponse from CMS SignedData object. * * @param signedData the CMS SignedData object containing the request * @throws org.spongycastle.dvcs.DVCSConstructionException */ public DVCSResponse(CMSSignedData signedData) throws DVCSConstructionException { this(SignedData.getInstance(signedData.toASN1Structure().getContent()).getEncapContentInfo()); }
private SignedData getSignedData() throws CMSException { try { return SignedData.getInstance(contentInfo.getContent()); } catch (ClassCastException e) { throw new CMSException("Malformed content.", e); } catch (IllegalArgumentException e) { throw new CMSException("Malformed content.", e); } }
private SignedData getSignedData() throws CMSException { try { return SignedData.getInstance(contentInfo.getContent()); } catch (ClassCastException e) { throw new CMSException("Malformed content.", e); } catch (IllegalArgumentException e) { throw new CMSException("Malformed content.", e); } }
public CMSDigestedData( ContentInfo contentInfo) throws CMSException { this.contentInfo = contentInfo; try { this.digestedData = DigestedData.getInstance(contentInfo.getContent()); } catch (ClassCastException e) { throw new CMSException("Malformed content.", e); } catch (IllegalArgumentException e) { throw new CMSException("Malformed content.", e); } }
public CMSDigestedData( ContentInfo contentInfo) throws CMSException { this.contentInfo = contentInfo; try { this.digestedData = DigestedData.getInstance(contentInfo.getContent()); } catch (ClassCastException e) { throw new CMSException("Malformed content.", e); } catch (IllegalArgumentException e) { throw new CMSException("Malformed content.", e); } }
public CMSCompressedData( ContentInfo contentInfo) throws CMSException { this.contentInfo = contentInfo; try { this.comData = CompressedData.getInstance(contentInfo.getContent()); } catch (ClassCastException e) { throw new CMSException("Malformed content.", e); } catch (IllegalArgumentException e) { throw new CMSException("Malformed content.", e); } }
/** Método que extrae el contenido de un tipo CompressedData. * @param data El tipo CompressedData. * @return El contenido del envoltorio. * @throws IOException Cuando hay un error de lectura de datos. * @throws DataFormatException Si los datos no estaban comprimidos. */ static byte[] getContentCompressedData(final byte[] data) throws IOException, DataFormatException { final ASN1Sequence contentEnvelopedData = Utils.fetchWrappedData(data); final CompressedData compressed = CompressedData.getInstance(contentEnvelopedData); final DEROctetString dos = (DEROctetString) compressed.getEncapContentInfo().getContent(); return BinaryUtils.uncompress(dos.getOctets()); } }
/** * Build the PKIArchiveControl using the passed in encryptor to encrypt its contents. * * @param contentEncryptor a suitable content encryptor. * @return a PKIArchiveControl object. * @throws CMSException in the event the build fails. */ public PKIArchiveControl build(OutputEncryptor contentEncryptor) throws CMSException { CMSEnvelopedData envContent = envGen.generate(keyContent, contentEncryptor); EnvelopedData envD = EnvelopedData.getInstance(envContent.toASN1Structure().getContent()); return new PKIArchiveControl(new PKIArchiveOptions(new EncryptedKey(envD))); } }
/** * Build the PKIArchiveControl using the passed in encryptor to encrypt its contents. * * @param contentEncryptor a suitable content encryptor. * @return a PKIArchiveControl object. * @throws CMSException in the event the build fails. */ public PKIArchiveControl build(OutputEncryptor contentEncryptor) throws CMSException { CMSEnvelopedData envContent = envGen.generate(keyContent, contentEncryptor); EnvelopedData envD = EnvelopedData.getInstance(envContent.toASN1Structure().getContent()); return new PKIArchiveControl(new PKIArchiveOptions(new EncryptedKey(envD))); } }