Ver Mensaje Individual
  #310 (permalink)  
Antiguo 12/01/2011, 17:52
jonasjimenez
 
Fecha de Ingreso: enero-2011
Mensajes: 3
Antigüedad: 13 años, 3 meses
Puntos: 0
Respuesta: Factura electroncia sat mexico

hOLA AMIGO ME PUEDES DECIR COM OLO HICISTE, YO HICE LOS SIGUIENTES PASOS UTILIZANDO EL COMPONENTE Chilkat PERO EL SELLO ES DIFERENTE EL QUE ME GENERA:s

Chilkat.PrivateKey llave = new PrivateKey();
Chilkat.Rsa AlgoritmoRSA = new Rsa();
Chilkat.Cert certificado = new Cert();
StringBuilder DetalleCertificado = new StringBuilder("Detalle del certificado: \n\n");
try
{
//Leemos la Ruta del Certificado .CER
certificado.LoadFromFile(fileCertificado.FullName) ;

//Detalle
DetalleCertificado.AppendLine("Persona = " + certificado.SubjectC);
DetalleCertificado.AppendLine("Emisor = " + certificado.IssuerO);
DetalleCertificado.AppendLine("Válido desde = " + certificado.ValidFrom.ToString());
DetalleCertificado.AppendLine("Válido hasta = " + certificado.ValidTo.ToString());
DetalleCertificado.AppendLine("Número de serie = " + certificado.SerialNumber);
DetalleCertificado.AppendLine("Hash = " + certificado.Sha1Thumbprint);

MessageBox.Show(DetalleCertificado.ToString());

//Cargamos la Ruta del Key .KEY y Password
llave.LoadPkcs8EncryptedFile(fileKey.FullName, "a0123456789"); //Pasamos la FIEL y la Contraseña

string KeyPEM = llave.GetXml();

AlgoritmoRSA.ImportPrivateKey(KeyPEM); //Generamos el KEY.PEM

AlgoritmoRSA.LittleEndian = false;
AlgoritmoRSA.Charset = "utf-8";
AlgoritmoRSA.EncodingMode = "base64";

AlgoritmoRSA.UnlockComponent("RSAT34MB34N_2637664B 634J");

string SelloDigital = AlgoritmoRSA.SignStringENC(txtCadenaSAT.Text, "md5");

MessageBox.Show("Sello Digital: \r\n" +SelloDigital);