Cita:
Empezado por JXJ
y como se genera el archivo .pem
a mi me pide contraseña o me da error.
pkcs8 -inform DER -in AAA010101AAA_0408021316S.key -out AAA010101AAA.key.pem
o mejor aun usando delphi, ¿como se hace?
|
te paso el codigo que yo utilice para convertir el archivo a .pem.
Código:
//---------------------------------------------------------
procedure TfrmEmpresa.KeyToPem;
var
BatFile: TStringList;
LlaveDerToPEM, OutFile, BatFileName: string;
begin
//Convertimos el CERTIFICADO de formato DER a formato PEM con la siguiente instrucción de OpenSSL
OutFile:= FolderFilesPEM + ExtractFileName(txtPrivateKey.Text)+'.pem';
LlaveDerToPEM := 'C:\MiFactura\Bin\openssl pkcs8 -inform DER -in '+ txtPrivateKey.Text +' -out ' + OutFile;
//Creamos el archivo .Bat
BatFileName:= 'C:\MiFactura\Bin\'+LlaveBat;
BatFile:= TStringList.Create;
BatFile.Add(LlaveDerToPEM);
BatFile.SaveToFile(BatFileName);
try
WinExecAndWait32(BatFileName,1);
except
on E : Exception do
ShowMessage(E.ClassName+' Se provoco la excepción : '+E.Message);
end;
if FileExists(OutFile) then begin
if LengthFile(OutFile) = 0 then
MessageDlg('Verifique que la contraseña sea correcta e intentelo nuevamente.', mtError, [mbOk], 0);
end;
PrivateKeyPemFile:= OutFile;
end;
//---------------------------------------------------------
Saludos.