PdfFileSecurity
Vue de l’ensemble
‘PdfFileSecurity’ est une classe dans Aspose.PDF FOSS pour .NET. Inhérents de: ‘IDisposable’.
Facade pour le chiffrement, la décryptage et le changement de mots de passe sur les fichiers PDF.
Cette classe fournit 31 méthodes pour travailler avec des objets de sécurité Pdf dans les programmes .NET. Les méthodologies disponibles comprennent: ‘BindPdf’, ‘ChangePassword’, ChangerPasswords', ‘Close’, 'DecryptFile', ’Dispose', ‚Encrypts‘, 'PdfFilesSecurity', ''Save, SetPrivilege , ‘TryChangPass word’, “TriDecypt File’ et 2 méthode supplémentaires. Tous les membres publics sont accessibles à n’importe quelle application .Net après l’installation de l’Aspose.PDF FOSS pour le package .net. Propriétés : ‘AllowExceptions’, ‘’InputFILE',''Stream',’’Last,''OutileStreaming`.
Propriétés
| Name | Type | Access | Description |
|---|---|---|---|
AllowExceptions | bool | Read/Write | When true, stateful operations propagate exceptions; when false (the default), Try* operations capture the last thrown exception in LastException and return false. |
LastException | Exception? | Read | Last exception captured by a Try* method, or null. |
InputFile | string | Read/Write | Set the input file path used by stateful operations. |
InputStream | Stream | Read/Write | Set the input stream used by stateful operations. |
OutputFile | string | Read/Write | Route the next Save to this file. |
OutputStream | Stream | Read/Write | Route the next Save to this stream. |
méthodes
| Signature | Description |
|---|---|
PdfFileSecurity() | Default ctor — for the static byte[]-based overloads. |
PdfFileSecurity(document: Document) | Wrap an existing Document; caller owns its lifetime. |
PdfFileSecurity(path: string) | Open the file at path and bind it. |
PdfFileSecurity(document: Document, outputStream: Stream) | Wrap a document and route subsequent saves to outputStream. |
PdfFileSecurity(document: Document, outputFile: string) | Wrap a document and route subsequent saves to outputFile. |
PdfFileSecurity(inputStream: Stream, outputStream: Stream) | Bind from a stream and save to a stream. |
PdfFileSecurity(inputFile: string, outputFile: string) | Bind from a path and save to a path. |
Dispose() | Calls Dispose on this PdfFileSecurity instance. |
Close() | Alias for Dispose. |
BindPdf(srcFile: string) | Bind to a PDF file at srcFile. |
BindPdf(srcStream: Stream) | Bind to a PDF read from srcStream. |
BindPdf(document: Document) | Bind to an existing Document; caller owns its lifetime. |
Save(path: string) | Save the bound document to a file path. |
Save(stream: Stream) | Save the bound document to a stream. |
EncryptFile(userPassword: string, ownerPassword: string, privilege: DocumentPrivilege, keySize: KeySize, cipher: Algorithm) | Encrypt the bound document. |
EncryptFile(userPassword: string, ownerPassword: string, privilege: DocumentPrivilege, keySize: KeySize) | Encrypt the bound document defaulting cipher to AES. |
TryEncryptFile(userPassword: string, ownerPassword: string, privilege: DocumentPrivilege, keySize: KeySize) | Try-variant of EncryptFile(string,string,DocumentPrivilege,KeySize,Algorithm). |
SetPrivilege(privilege: DocumentPrivilege) | Apply privilege flags to the bound document by re-encrypting with empty passwords and the given permissions. |
SetPrivilege(userPassword: string, ownerPassword: string, privilege: DocumentPrivilege) | Apply privilege flags with explicit passwords. |
TrySetPrivilege(userPassword: string, ownerPassword: string, privilege: DocumentPrivilege) | Try-variant of SetPrivilege(string,string,DocumentPrivilege). |
DecryptFile(ownerPassword: string) | Decrypt the bound document using the given password. |
TryDecryptFile(ownerPassword: string) | Try-variant of DecryptFile(string). |
ChangePassword(ownerPassword: string, newUserPassword: string, newOwnerPassword: string) | Change passwords on the bound document while preserving existing privileges and AES-128 encryption. |
ChangePassword(ownerPassword: string, newUserPassword: string, newOwnerPassword: string, privilege: DocumentPrivilege, keySize: KeySize) | Change passwords and override privileges + key size. |
ChangePassword(ownerPassword: string, newUserPassword: string, newOwnerPassword: string, privilege: DocumentPrivilege, keySize: KeySize, cipher: Algorithm) | Change passwords and override privileges + key size + cipher. |
TryChangePassword(ownerPassword: string, newUserPassword: string, newOwnerPassword: string) | Try-variant of ChangePassword(string,string,string). |
TryChangePassword(ownerPassword: string, newUserPassword: string, newOwnerPassword: string, privilege: DocumentPrivilege, keySize: KeySize) | Try-variant of the 5-arg ChangePassword(string,string,string,DocumentPrivilege,KeySize). |
TryChangePassword(ownerPassword: string, newUserPassword: string, newOwnerPassword: string, privilege: DocumentPrivilege, keySize: KeySize, cipher: Algorithm) | Try-variant of the 6-arg ChangePassword(string,string,string,DocumentPrivilege,KeySize,Algorithm). |
EncryptFile(input: byte[], userPassword: string, ownerPassword: string, permissions: DocumentPrivilege?, algorithm: CryptoAlgorithm) | Encrypt a PDF with the specified passwords and algorithm. |
DecryptFile(input: byte[], password: string) | Remove encryption from a PDF using the correct password. |
ChangePasswords(input: byte[], oldOwnerPassword: string, newUserPassword: string, newOwnerPassword: string, algorithm: CryptoAlgorithm) | Change the passwords on an encrypted PDF. |
Voir aussi
- Aspose.PDF pour .NET — API d’entreprise