Package no.difi.asic.extras
Class CmsEncryptedAsicWriter
java.lang.Object
no.difi.asic.extras.CmsEncryptedAsicWriter
- All Implemented Interfaces:
AsicWriter
Wrapper to seamlessly encode specific files.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCmsEncryptedAsicWriter(AsicWriter asicWriter, X509Certificate certificate) CmsEncryptedAsicWriter(AsicWriter asicWriter, X509Certificate certificate, org.bouncycastle.asn1.ASN1ObjectIdentifier cmsAlgorithm) -
Method Summary
Modifier and TypeMethodDescriptionAdds another data object to the ASiC archive.Adds another data object to the ASiC container, using the supplied name as the zip entry nameAdds the contents of a file into the ASiC archive using the supplied entry name and MIME type.add(InputStream inputStream, String filename) Adds the data provided by the stream into the ASiC archive, using the name of the supplied file as the entry name.add(InputStream inputStream, String filename, MimeType mimeType) Adds the contents of an input stream into the ASiC archive, under a given entry name and explicitly identifying the MIME type.Adds another data object to the ASiC archiveAdds another data object to the ASiC container under the entry name provided.addEncrypted(File file) addEncrypted(File file, String entryName) addEncrypted(File file, String entryName, MimeType mimeType) addEncrypted(InputStream inputStream, String filename) addEncrypted(InputStream inputStream, String filename, MimeType mimeType) addEncrypted(Path path) addEncrypted(Path path, String entryName) addEncrypted(Path path, String entryName, MimeType mimeType) setRootEntryName(String name) Specifies which entry (file) represents the "root" document, i.e. which business document to read first.Signs and closes the ASiC archive.Signs and closes the ASiC archive using the private and public key stored in the supplied key store under the supplied alias name.sign(File keyStoreFile, String keyStorePassword, KeyStoreType keyStoreType, String keyAlias, String keyPassword) Signs and closes the ASiC archive using the private and public key stored in the supplied key store under the supplied alias name.sign(SignatureHelper signatureHelper) Allows re-use of the same SignatureHelper object when creating multiple ASiC archive and hence the need to create multiple signatures.
-
Field Details
-
BC
- See Also:
-
-
Constructor Details
-
CmsEncryptedAsicWriter
-
CmsEncryptedAsicWriter
public CmsEncryptedAsicWriter(AsicWriter asicWriter, X509Certificate certificate, org.bouncycastle.asn1.ASN1ObjectIdentifier cmsAlgorithm)
-
-
Method Details
-
add
Adds another data object to the ASiC archive.- Specified by:
addin interfaceAsicWriter- Parameters:
file- references the file to be added as a data object. The name of the entry is extracted from the File object.- Returns:
- reference to this AsicWriter
- Throws:
IOException
-
add
Adds another data object to the ASiC container, using the supplied name as the zip entry name- Specified by:
addin interfaceAsicWriter- Parameters:
file- references the file to be added as a data object.entryName- the archive entry name to be used.- Returns:
- reference to this AsicWriter
- Throws:
IOException
-
add
Adds another data object to the ASiC archive- Specified by:
addin interfaceAsicWriter- Parameters:
path- references the file to be added.- Returns:
- reference to this AsicWriter
- Throws:
IOException- See Also:
-
add
Adds another data object to the ASiC container under the entry name provided.- Specified by:
addin interfaceAsicWriter- Parameters:
path- reference to this AsicWriter.entryName- the archive entry name to be used.- Returns:
- reference to this AsicWriter
- Throws:
IOException- See Also:
-
add
Adds the data provided by the stream into the ASiC archive, using the name of the supplied file as the entry name.- Specified by:
addin interfaceAsicWriter- Parameters:
inputStream- input stream of data.filename- the name of a file, which must be available in the file system in order to determine the MIME type.- Returns:
- reference to this AsicWriter
- Throws:
IOException
-
add
Adds the contents of a file into the ASiC archive using the supplied entry name and MIME type.- Specified by:
addin interfaceAsicWriter- Parameters:
file- references the file to be added as a data object.entryName- the archive entry name to be used.mimeType- explicitly identifies the MIME type of the entry.- Returns:
- reference to this AsicWriter
- Throws:
IOException
-
add
- Specified by:
addin interfaceAsicWriter- Throws:
IOException- See Also:
-
add
public AsicWriter add(InputStream inputStream, String filename, MimeType mimeType) throws IOException Adds the contents of an input stream into the ASiC archive, under a given entry name and explicitly identifying the MIME type.- Specified by:
addin interfaceAsicWriter- Throws:
IOException- See Also:
-
addEncrypted
- Throws:
IOException
-
addEncrypted
- Throws:
IOException
-
addEncrypted
- Throws:
IOException
-
addEncrypted
- Throws:
IOException
-
addEncrypted
- Throws:
IOException
-
addEncrypted
- Throws:
IOException
-
addEncrypted
- Throws:
IOException
-
addEncrypted
public AsicWriter addEncrypted(InputStream inputStream, String filename, MimeType mimeType) throws IOException - Throws:
IOException
-
setRootEntryName
Description copied from interface:AsicWriterSpecifies which entry (file) represents the "root" document, i.e. which business document to read first.- Specified by:
setRootEntryNamein interfaceAsicWriter- Parameters:
name- of entry holding the root document.- Returns:
- reference to this AsicWriter
-
sign
public AsicWriter sign(File keyStoreFile, String keyStorePassword, String keyPassword) throws IOException Description copied from interface:AsicWriterSigns and closes the ASiC archive. The private and public key is obtained from the supplied key store.- Specified by:
signin interfaceAsicWriter- Parameters:
keyStoreFile- the file holding the JKS keystore file.keyStorePassword- password for the keystorekeyPassword- password protecting the private key.- Returns:
- reference to this AsicWriter
- Throws:
IOException
-
sign
public AsicWriter sign(File keyStoreFile, String keyStorePassword, String keyAlias, String keyPassword) throws IOException Description copied from interface:AsicWriterSigns and closes the ASiC archive using the private and public key stored in the supplied key store under the supplied alias name.- Specified by:
signin interfaceAsicWriter- Parameters:
keyStoreFile- the file holding the JKS keystore file.keyStorePassword- password for the keystorekeyAlias- the alias of the keystore entry holding the private and the public key.keyPassword- password protecting the private key.- Returns:
- reference to this AsicWriter
- Throws:
IOException
-
sign
Description copied from interface:AsicWriterAllows re-use of the same SignatureHelper object when creating multiple ASiC archive and hence the need to create multiple signatures.- Specified by:
signin interfaceAsicWriter- Parameters:
signatureHelper- instantiated SignatureHelper- Returns:
- reference to this AsicWriter
- Throws:
IOException- See Also:
-
sign
public AsicWriter sign(File keyStoreFile, String keyStorePassword, KeyStoreType keyStoreType, String keyAlias, String keyPassword) throws IOException Description copied from interface:AsicWriterSigns and closes the ASiC archive using the private and public key stored in the supplied key store under the supplied alias name.- Specified by:
signin interfaceAsicWriter- Parameters:
keyStoreFile- the file holding the keystore file.keyStorePassword- password for the keystorekeyStoreType- Type of keyStorekeyAlias- the alias of the keystore entry holding the private and the public key.keyPassword- password protecting the private key.- Returns:
- reference to this AsicWriter
- Throws:
IOException
-