Cómo usar IronSecureDoc desde C# en .NET

This article was translated from English: Does it need improvement?
Translated
View the article in English

Su puerta de entrada a una mayor seguridad de los documentos

Iron Software.SecureDoc.Client es una robusta biblioteca del lado del cliente diseñada para interactuar sin problemas con la API IronSecureDoc, una solución integral de seguridad de documentos alojada en un contenedor Docker.

Esta biblioteca cliente facilita la integración sencilla en sus aplicaciones .NET existentes, lo que le permite aprovechar las potentes características de IronSecureDoc, incluida la encriptación de PDF, redacción y firma digital, todo a través de simples llamadas a la API REST.

Con Iron Software.SecureDoc.Client, los desarrolladores pueden garantizar la seguridad e integridad de los documentos dentro de sus aplicaciones, manteniendo todas las operaciones in situ para una mayor protección de los datos. Ya sea que necesite redactar información confidencial, certificar documentos con firmas digitales o aplicar el cifrado de documentos, Iron Software.SecureDoc.Client proporciona las herramientas necesarias para realizar estas tareas de manera eficiente y segura.

Características

Características clave:

  • Integración sencilla con la API REST de IronSecureDoc.
  • Soporte para encriptación de documentos, redacción y firmas digitales.
  • Facilita el procesamiento seguro de documentos dentro de entornos autoalojados.
  • Mejora la protección de datos al mantener las operaciones de seguridad de documentos en el sitio.
  • Compatible con aplicaciones .NET, ofreciendo un enfoque simple para la gestión segura de documentos.

Instalación

Comencemos instalando el paquete NuGet desde el administrador de paquetes:

Opción 1: Descargar desde NuGet

El paquete NuGet está listado aquí en el sitio web oficial de NuGet: https://www.nuget.org/packages/IronSoftware.SecureDoc.Client

Opción 2: Comando de instalación de PM

Install-Package IronSoftware.SecureDoc.Client

Ejemplo de código

using IronSecureDoc;
using System.IO;
using System.Threading.Tasks;

// Example illustrating how to use the IronSecureDocClient
class SecureDocExample
{
    static async Task Main(string[] args)
    {
        // Replace with your IRONSECUREDOC URL
        var client = new IronSecureDocClient("http://localhost:5185");

        // Replace with your PDF or CERT paths
        string PDF_PATH = "path/to/your.pdf";
        string CERT_PATH = "path/to/your.p12";

        // Attempt to connect to the IronSecureDoc API
        if (await client.TryConnectAsync())
        {
            // Redact Text
            File.WriteAllBytes(
                "redact_text_example.pdf",
                await client.RedactTextAsync(PDF_PATH, new[] { "Dummy" })
            );

            // Redact Region
            File.WriteAllBytes(
                "redact_region_example.pdf",
                await client.RedactRegionAsync(PDF_PATH, 50, 50, 200, 100)
            );

            // Certify
            File.WriteAllBytes(
                "certify_example.pdf",
                await client.CertifyAsync(PDF_PATH, CERT_PATH, "123456", CertifyPermissions.FormFillingAllowed)
            );

            // Encrypt
            File.WriteAllBytes(
                "encrypt_example.pdf",
                await client.EncryptAsync(PDF_PATH, "iron")
            );
        }
    }
}
using IronSecureDoc;
using System.IO;
using System.Threading.Tasks;

// Example illustrating how to use the IronSecureDocClient
class SecureDocExample
{
    static async Task Main(string[] args)
    {
        // Replace with your IRONSECUREDOC URL
        var client = new IronSecureDocClient("http://localhost:5185");

        // Replace with your PDF or CERT paths
        string PDF_PATH = "path/to/your.pdf";
        string CERT_PATH = "path/to/your.p12";

        // Attempt to connect to the IronSecureDoc API
        if (await client.TryConnectAsync())
        {
            // Redact Text
            File.WriteAllBytes(
                "redact_text_example.pdf",
                await client.RedactTextAsync(PDF_PATH, new[] { "Dummy" })
            );

            // Redact Region
            File.WriteAllBytes(
                "redact_region_example.pdf",
                await client.RedactRegionAsync(PDF_PATH, 50, 50, 200, 100)
            );

            // Certify
            File.WriteAllBytes(
                "certify_example.pdf",
                await client.CertifyAsync(PDF_PATH, CERT_PATH, "123456", CertifyPermissions.FormFillingAllowed)
            );

            // Encrypt
            File.WriteAllBytes(
                "encrypt_example.pdf",
                await client.EncryptAsync(PDF_PATH, "iron")
            );
        }
    }
}
Imports IronSecureDoc
Imports System.IO
Imports System.Threading.Tasks

' Example illustrating how to use the IronSecureDocClient
Friend Class SecureDocExample
	Shared Async Function Main(ByVal args() As String) As Task
		' Replace with your IRONSECUREDOC URL
		Dim client = New IronSecureDocClient("http://localhost:5185")

		' Replace with your PDF or CERT paths
		Dim PDF_PATH As String = "path/to/your.pdf"
		Dim CERT_PATH As String = "path/to/your.p12"

		' Attempt to connect to the IronSecureDoc API
		If Await client.TryConnectAsync() Then
			' Redact Text
			File.WriteAllBytes("redact_text_example.pdf", Await client.RedactTextAsync(PDF_PATH, { "Dummy" }))

			' Redact Region
			File.WriteAllBytes("redact_region_example.pdf", Await client.RedactRegionAsync(PDF_PATH, 50, 50, 200, 100))

			' Certify
			File.WriteAllBytes("certify_example.pdf", Await client.CertifyAsync(PDF_PATH, CERT_PATH, "123456", CertifyPermissions.FormFillingAllowed))

			' Encrypt
			File.WriteAllBytes("encrypt_example.pdf", Await client.EncryptAsync(PDF_PATH, "iron"))
		End If
	End Function
End Class
$vbLabelText   $csharpLabel

Explicación

  • Inicialización de IronSecureDocClient: Inicie el IronSecureDocClient con la URL de su servidor IRONSECUREDOC.
  • Conexión: Use TryConnectAsync() para verificar la conexión al servidor.
  • Redactar texto: Defina palabras/frases sensibles para redactar usando RedactTextAsync.
  • Redactar región: Redacte regiones específicas especificando coordenadas con RedactRegionAsync.
  • Certificar: Agregue una certificación digital con CertifyAsync. Proporcione la ruta al archivo de certificación y una contraseña.
  • Encriptar: Proteja el documento encriptándolo usando EncryptAsync.

Apoyo

Para soporte, por favor contáctenos: support@ironsoftware.com

Preguntas Frecuentes

¿Cómo integro funciones de seguridad de documentos en mi aplicación .NET?

Puede integrar funciones de seguridad de documentos usando la biblioteca Iron Software.SecureDoc.Client. Esto le permite realizar operaciones como encriptación de PDF, redacción y firma digital a través de llamadas REST API.

¿Qué pasos están involucrados en la instalación del cliente IronSecureDoc en un proyecto C#?

Para instalar el cliente IronSecureDoc en un proyecto C#, puede descargar el paquete Iron Software.SecureDoc.Client desde NuGet o usar el comando del Administrador de Paquetes: Install-Package Iron Software.SecureDoc.Client.

¿Puedo realizar la redacción de texto en documentos PDF con esta solución?

Sí, puede realizar la redacción de texto en documentos PDF usando el método RedactTextAsync, que le permite especificar las palabras o frases que desea redactar.

¿Cómo puedo asegurar que mis operaciones de documentos sigan siendo seguras y locales?

Usar IronSecureDoc mantiene las operaciones de documentos seguras y locales al integrarse con la API de IronSecureDoc, una solución alojada en Docker, asegurando que todos los procesos de seguridad se manejen localmente.

¿Qué capacidades ofrece la API de IronSecureDoc para la gestión de documentos?

La API de IronSecureDoc ofrece capacidades como encriptación de documentos, redacción, firma digital y facilita el procesamiento seguro de documentos dentro de entornos autohospedados.

¿Cómo certifico un documento PDF con una firma digital?

Para certificar un documento PDF con una firma digital, use el método CertifyAsync, proporcionando la ruta a su archivo de certificación y la contraseña necesaria.

¿Cómo puedo encriptar un documento PDF en mi aplicación C#?

Puede encriptar un documento PDF en su aplicación C# usando el método EncryptAsync, que asegura el documento con una contraseña especificada.

¿Es posible redactar regiones específicas en un documento PDF?

Sí, es posible redactar regiones específicas en un documento PDF usando el método RedactRegionAsync, que requiere especificar las coordenadas del área que desea redactar.

¿Qué debo hacer si encuentro problemas usando el cliente IronSecureDoc?

Si encuentra problemas usando el cliente IronSecureDoc, puede contactar al equipo de soporte de Iron Software vía email en support@Iron Software.com para obtener asistencia.

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más
¿Listo para empezar?
Version: 2024.10 recién lanzado