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 LongDLL
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
| SubjectName | El sujeto, con prefijo CN= cuando no contiene ningún carácter = |
|---|---|
| PFXFileName | El archivo PFX que se escribe |
| PFXPassword | La contraseña del PFX |
| ValidDays | Días de validez, mínimo 1; los valores por debajo de 1 pasan a 365 |
| KeyBits | Longitud RSA en bits para KeyKind 0; selector de curva 256/384/521 para KeyKind 1, otros valores seleccionan P-256 |
| KeyKind | 0 = RSA, 1 = ECDSA |
Valores devueltos
| 1 | El certificado y el PFX se escribieron |
|---|---|
| 0 | La generación o la exportación falló; en plataformas no Windows la generación ECDSA no está disponible |