skyghis / j-interop-ng

j-interop based on jcifs-ng
GNU Lesser General Public License v3.0
14 stars 8 forks source link

java.security.NoSuchAlgorithmException: MD4 MessageDigest not available #22

Closed thegamingrip closed 1 year ago

thegamingrip commented 1 year ago

Screenshot_1

skyghis commented 1 year ago

You probably have a JDK not containing MD4 Message digest. More details on the issue would help.

If your JDK don't contain lib needed to hash MD4, you probably need to add a dependency to support this algorithm.

thegamingrip commented 1 year ago

Hello skyghis, thank you very much for answering my problem.

I attach 2 screenshots that show the SDK version. and the other is the breakpoint that I have the fault with.

Screenshot_1 Screenshot_2

skyghis commented 1 year ago

You seem to use an Android SDK. You probably need to add a library containing MD4, like Bouncy Castle.

thegamingrip commented 1 year ago

Thank you so much! Adding the 'Bouncy Castle' implementation fixed the problem.

Finally the code is like this:

import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.crypto.digests.MD4Digest;
import org.bouncycastle.util.encoders.Hex;

public static byte[] md4(final byte[] input) {

        MD4Digest digest = new MD4Digest();
        byte[] output = new byte[digest.getDigestSize()];

        digest.update(input, 0, input.length);
        digest.doFinal(output, 0);

        return output;
    }

My project is to be able to view data from an OPC Server on an Andriod device. I could already do it with an OPC UA server that is a bit more modern and the security is not through DCOM.

Now I get this error: org.jinterop.dcom.common.jiexception: access is denied, please make sure that the domain/username/password are correct [0x00000005]

My test server is mounted on a machine with windows 10, but the machine that is in service with the real data is on Windows Server 2012. Within my network I modified everything so that clients connected to other windows pc regardless of the operating system They connect to the server and it works perfectly.

Do you know any case of someone who has done readings from an OPC DA server with an Android device?

skyghis commented 1 year ago

The new error is not related to MD4, I close the issue.

For error 0x00000005 check for user rights on registry. You could find some explanation on how to do it in internet.