public PdfWriter(Stream os, WriterProperties properties) : base(FileUtil.WrapWithBufferedOutputStream(os)) { // For internal usage only //forewarned is forearmed this.properties = properties; EncryptionProperties encryptProps = properties.encryptionProperties; if (properties.IsStandardEncryptionUsed()) { crypto = new PdfEncryption(encryptProps.userPassword, encryptProps.ownerPassword, encryptProps.standardEncryptPermissions , encryptProps.encryptionAlgorithm, PdfEncryption.GenerateNewDocumentId()); } else { if (properties.IsPublicKeyEncryptionUsed()) { crypto = new PdfEncryption(encryptProps.publicCertificates, encryptProps.publicKeyEncryptPermissions, encryptProps .encryptionAlgorithm); } } if (properties.debugMode) { SetDebugMode(); } }
protected internal virtual void InitCryptoIfSpecified(PdfVersion version) { EncryptionProperties encryptProps = properties.encryptionProperties; if (properties.IsStandardEncryptionUsed()) { crypto = new PdfEncryption(encryptProps.userPassword, encryptProps.ownerPassword, encryptProps.standardEncryptPermissions , encryptProps.encryptionAlgorithm, PdfEncryption.GenerateNewDocumentId(), version); } else { if (properties.IsPublicKeyEncryptionUsed()) { crypto = new PdfEncryption(encryptProps.publicCertificates, encryptProps.publicKeyEncryptPermissions, encryptProps .encryptionAlgorithm, version); } } }
protected internal virtual void InitCryptoIfSpecified(PdfVersion version) { EncryptionProperties encryptProps = properties.encryptionProperties; if (properties.IsStandardEncryptionUsed()) { crypto = new PdfEncryption(encryptProps.userPassword, encryptProps.ownerPassword, encryptProps.standardEncryptPermissions , encryptProps.encryptionAlgorithm, ByteUtils.GetIsoBytes(this.document.GetOriginalDocumentId().GetValue ()), version); } else { if (properties.IsPublicKeyEncryptionUsed()) { crypto = new PdfEncryption(encryptProps.publicCertificates, encryptProps.publicKeyEncryptPermissions, encryptProps .encryptionAlgorithm, version); } } }