[code]encodeBase64Cancelacion (ByRef arrData() As Byte)
Dim objXML As XmlDocument
Dim objNode As XmlElement
objXML = New XmlDocument
objNode = objXML.createElement(“b64”)
EncodeBase64 is supposed to recieve a string and i´ve got a binary array.
But in LR it also says “EncodeBase64 lets you encode arbitrary binary data into a 64-character alphabet composed of the printable ASCII characters.”
So, will it work? i`ll try…
is this the method that got the data from the byte array we converted last week ?
the reason I ask is that there are some things that in vb you would do very differently in xojo
like passing around an array of bytes instead of a memoryblock
and a memoryblock can be encoded in base 64 with 1 line of code
Yes the one last week is the first method i got, it calls the second one.
Well, here are both methods i got in vb6 to code into xojo:
Public Sub ObtenerCertificadoBase64()
Dim fileNum As Integer
Dim fileLength As Integer
Dim bytes() As Byte
Dim data As Byte
Dim i As Long
fileNum = FreeFile
Open "C:\\TimbrarFactureHoyConPeticionSoap\\PKI\\archivo.pfx" For Binary As fileNum
fileLength = LOF(fileNum)
ReDim bytes(fileLength)
i = 0
Do While Not EOF(fileNum)
Get fileNum, , data
bytes(i) = data
i = i + 1
Loop
Close fileNum
PfxEnBase64 = encodeBase64(bytes)
End Sub
[code]Private Function encodeBase64(ByRef arrData() As Byte) As String
Dim objXML As MSXML2.DOMDocument
Dim objNode As MSXML2.IXMLDOMElement
Set objXML = New MSXML2.DOMDocument
Set objNode = objXML.createElement("b64")
objNode.DataType = "bin.base64"
objNode.nodeTypedValue = arrData
encodeBase64 = objNode.Text
Set objNode = Nothing
Set objXML = Nothing
Public Sub ObtenerCertificadoBase64()
dim f as Folderitem = GetFolderItem("C:\\TimbrarFactureHoyConPeticionSoap\\PKI\\archivo.pfx", Folderitem.PathTypeNative)
dim b as binaryStream = BinaryStream.Open( f )
dim bytes as string = b.Read( b.length )
PfxEnBase64 = encodeBase64(bytes)
End Sub
This is why I suggested not trying to “port” code but literally rewrite it in Xojo
If you try to port code you end up doing a lot of unnecessary gyrations
well pretty impresive.
at least i got no errors and the project does run.
I just have to check on the results.
thank you Norman and the rest of you guys!