CreateSelfSignedCertificateEx

Seguridad y firmas

Descripción

Crea un certificado autofirmado con un algoritmo de clave seleccionable y lo exporta — clave privada incluida — a un archivo PFX protegido con contraseña

KeyKind 0 mantiene la ruta RSA heredada de CreateSelfSignedCertificate; KeyKind 1 crea una clave ECDSA a través del proveedor CNG Microsoft Software Key Storage Provider, mapeando KeyBits 256/384/521 a las curvas P-256/P-384/P-521 y firmando el certificado con ecdsa-with-SHA256

La clave ECDSA vive en un contenedor CNG desechable que se borra tras la exportación; solo el archivo PFX conserva el material de clave

Sintaxis

Delphi

Function TPDFlib.CreateSelfSignedCertificateEx(Const SubjectName, PFXFileName, PFXPassword: WideString; ValidDays, KeyBits, KeyKind: Integer): Integer;

ActiveX

Function PDFlib::CreateSelfSignedCertificateEx(SubjectName As String, PFXFileName As String, PFXPassword As String, ValidDays As Long, KeyBits As Long, KeyKind As Long) As Long

DLL

int DLCreateSelfSignedCertificateEx(int InstanceID, const wchar_t* SubjectName, const wchar_t* PFXFileName, const wchar_t* PFXPassword, int ValidDays, int KeyBits, int KeyKind);
int DLCreateSelfSignedCertificateExA(int InstanceID, const char* SubjectName, const char* PFXFileName, const char* PFXPassword, int ValidDays, int KeyBits, int KeyKind);

Parámetros

SubjectNameEl sujeto, con prefijo CN= cuando no contiene ningún carácter =
PFXFileNameEl archivo PFX que se escribe
PFXPasswordLa contraseña del PFX
ValidDaysDías de validez, mínimo 1; los valores por debajo de 1 pasan a 365
KeyBitsLongitud RSA en bits para KeyKind 0; selector de curva 256/384/521 para KeyKind 1, otros valores seleccionan P-256
KeyKind0 = RSA, 1 = ECDSA

Valores devueltos

1El certificado y el PFX se escribieron
0La generación o la exportación falló; en plataformas no Windows la generación ECDSA no está disponible

Véase también

CreateSelfSignedCertificate, SetSignProcessPFXFromFile