https://bugs.documentfoundation.org/show_bug.cgi?id=93221

            Bug ID: 93221
           Summary: "object variable not set" fault with Basic using
                    CryptographicService with 64 bit LibreOffice an 64 bit
                    windows
           Product: LibreOffice
           Version: 5.0.0.5 release
          Hardware: Other
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: major
          Priority: medium
         Component: Calc
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: zpm...@gmail.com

I downloaded and installed the latest LibreOffice 64 bit version and since I
did that my cryptography Basic code does not work. It throws the "object
variable not set" error message.
This code is what I use. I modified the original code because the MD5 sometimes
generates shorter than 32 character code and need to be filled with a 0 at the
start of the MD5 code, which is another problem in the Cryptographic service,
but I removed it and put it back as the original code to make sure that not my
modification cause it. It turns out that it throws the same error message that
way too.
It throws the error at the line TextHash = objDecrypt.GetTextHash(strText,
strAlgorithm)

When I was using it with my modification it throws the error at this line 
tempText = objDecrypt.GetTextHash(strText, strAlgorithm)

Below is the complete set of Basic code for the original functioning without
the zero correction.

REM texthash(CONCATENATE(A2,"idta"),"MD5"))


REM Propósito: Computes hashes (message digests) of text and files using
following hashing algorithms: MD2, MD5, SHA-1, SHA-256, SHA-384 and SHA-512
REM Informações sobre o Módulo: Módulo Padrão = basMain
REM Convenção para nomeclatura das versões: a.mm[.dd]: Nome do Revisor (e-mail)
REM Autor: Claudio Gomes Riella (cgrie...@ufrgs.br)
REM Versões:
REM        1.10.01 (1º/10/2009): Claudio Gomes Riella (cgrie...@ufrgs.br)
REM Parâmetros<-Argumentos:    Main
REM                            FileHash(strFullPathName as String, strAlgorithm
As String) <- Calc function FILEHASH(Cell; Algorithm)
REM                         TextHash(strText as String, strAlgorithm As String)
<- Calc function TEXTHASH(Cell; Algorithm)
REM Resultados: return message digests
REM Requisitos mínimos: BrOffice.org 3.1.0 ou OpenOffice.org 3.1.0 +
Cryptographic Service 1.10.01
REM Licença: LGPL

Sub Main
    Dim strFullPathName as String, sbNewLine as String
    sbNewLine = Chr(13) + Chr(10)
    strFullPathName = inputbox ("Insert the path of file")
    msgbox "File is """ & strFullPathName & """" & sbNewLine & "FileHash: " &
FileHash(strFullPathName, "MD5") & sbNewLine & "TextHash: " &
TextHash(strFullPathName, "MD5")
End Sub

Function FileHash(strFullPathName as String, strAlgorithm As String)
    Dim objDecrypt As Object
    Set objDecrypt =
CreateUnoService("org.openoffice.Cryptographic.CryptographicService")
    FileHash = objDecrypt.GetFileHash(strFullPathName, strAlgorithm)
End Function

Function TextHash(strText as String, strAlgorithm As String)
    Dim objDecrypt As Object
    Dim LResult As Long
    Dim tempText As String
    Dim textLength As Integer
    Set objDecrypt =
CreateUnoService("org.openoffice.Cryptographic.CryptographicService")

REM    tempText = objDecrypt.GetTextHash(strText, strAlgorithm)
REM    textLength = Len(tempText)

REM    If strAlgorithm = "MD5" Then
REM        If textLength = 32 Then
REM            tempText = ""
REM        ElseIf textLength = 31 Then
REM            tempText = "0" 
REM        ElseIf textLength = 30 Then
REM            tempText = "00"
REM        ElseIf textLength = 29 Then
REM            tempText = "000"
REM        ElseIf textLength = 28 Then
REM            tempText = "0000"
REM        ElseIf textLength = 27 Then
REM            tempText = "00000"
REM        ElseIf textLength = 26 Then
REM            tempText = "000000"
REM        End If
REM    else
REM        tempText = ""
REM    End If

REM    TextHash = tempText + objDecrypt.GetTextHash(strText, strAlgorithm)

    TextHash = objDecrypt.GetTextHash(strText, strAlgorithm)
End Function

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to