SELLO 2048bits
Publicado: Vie Abr 29, 2016 3:38 pm
Hola AMigos,
Al generar el sello del xml y validarla, me dice que el el sello es invalido, esto comenzo para los .cer de 2048bits.
Les dejo mi codigo y espero me pueden ayudar..saludos....
Private Function GenerarSello() As String
Dim pkey As New privateKey
Dim success As Long
Dim pkeyXml As String
Dim rsa As New ChilkatRsa
tConf.MoveFirst
tPaises.Index = "Clave"
tPaises.Seek "=", tConf!Pais
If Not tPaises.NoMatch Then
pkey.LoadPkcs8EncryptedFile tPaises!Key, tPaises!ClaveCer
End If
pkeyXml = pkey.GetXml()
success = rsa.UnlockComponent(CK_KEY)
If (success <> 1) Then
Debug.Print rsa.LastErrorText & vbCrLf
Exit Function
End If
success = rsa.GenerateKey(2048)
If (success <> 1) Then
Debug.Print rsa.LastErrorText & vbCrLf
Form1.Text1.Text = rsa.LastErrorText
MsgBox rsa.LastErrorText
Exit Function
End If
success = rsa.ImportPrivateKey(pkeyXml)
If (success <> 1) Then
Debug.Print rsa.LastErrorText & vbCrLf
MsgBox rsa.LastErrorText
Exit Function
End If
rsa.Charset = "utf-8"
rsa.EncodingMode = "base64"
rsa.LittleEndian = 0
Dim base64Sig As String
base64Sig = rsa.SignStringENC(GetCadenaOriginal(m_xmlDOM), "sha-1")
GenerarSello = base64Sig
End Function
Al generar el sello del xml y validarla, me dice que el el sello es invalido, esto comenzo para los .cer de 2048bits.
Les dejo mi codigo y espero me pueden ayudar..saludos....
Private Function GenerarSello() As String
Dim pkey As New privateKey
Dim success As Long
Dim pkeyXml As String
Dim rsa As New ChilkatRsa
tConf.MoveFirst
tPaises.Index = "Clave"
tPaises.Seek "=", tConf!Pais
If Not tPaises.NoMatch Then
pkey.LoadPkcs8EncryptedFile tPaises!Key, tPaises!ClaveCer
End If
pkeyXml = pkey.GetXml()
success = rsa.UnlockComponent(CK_KEY)
If (success <> 1) Then
Debug.Print rsa.LastErrorText & vbCrLf
Exit Function
End If
success = rsa.GenerateKey(2048)
If (success <> 1) Then
Debug.Print rsa.LastErrorText & vbCrLf
Form1.Text1.Text = rsa.LastErrorText
MsgBox rsa.LastErrorText
Exit Function
End If
success = rsa.ImportPrivateKey(pkeyXml)
If (success <> 1) Then
Debug.Print rsa.LastErrorText & vbCrLf
MsgBox rsa.LastErrorText
Exit Function
End If
rsa.Charset = "utf-8"
rsa.EncodingMode = "base64"
rsa.LittleEndian = 0
Dim base64Sig As String
base64Sig = rsa.SignStringENC(GetCadenaOriginal(m_xmlDOM), "sha-1")
GenerarSello = base64Sig
End Function