Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android build with R8 Missing class warnings #633

Open
KimiChiu opened this issue Aug 23, 2024 · 1 comment
Open

Android build with R8 Missing class warnings #633

KimiChiu opened this issue Aug 23, 2024 · 1 comment

Comments

@KimiChiu
Copy link

{"kind":"warning","text":"Missing class com.sun.jna.Memory (referenced from: com.sun.jna.platform.win32.WinUser$COPYDATASTRUCT com.jcraft.jsch.PageantConnector.createCDS(java.lang.String))
Missing class com.sun.jna.Pointer (referenced from: com.sun.jna.platform.win32.WinUser$COPYDATASTRUCT com.jcraft.jsch.PageantConnector.createCDS(java.lang.String) and 2 other contexts)
Missing class com.sun.jna.platform.win32.BaseTSD$ULONG_PTR (referenced from: com.sun.jna.platform.win32.WinUser$COPYDATASTRUCT com.jcraft.jsch.PageantConnector.createCDS(java.lang.String) and 1 other context)
Missing class com.sun.jna.platform.win32.Kernel32 (referenced from: com.sun.jna.platform.win32.Kernel32 com.jcraft.jsch.PageantConnector.kernel32 and 2 other contexts)
Missing class com.sun.jna.platform.win32.User32 (referenced from: com.sun.jna.platform.win32.User32 com.jcraft.jsch.PageantConnector.user32 and 4 other contexts)
Missing class com.sun.jna.platform.win32.WinBase$SECURITY_ATTRIBUTES (referenced from: void com.jcraft.jsch.PageantConnector.query(com.jcraft.jsch.Buffer))
Missing class com.sun.jna.platform.win32.WinBase (referenced from: void com.jcraft.jsch.PageantConnector.query(com.jcraft.jsch.Buffer))
Missing class com.sun.jna.platform.win32.WinDef$HWND (referenced from: boolean com.jcraft.jsch.PageantConnector.isAvailable() and 2 other contexts)
Missing class com.sun.jna.platform.win32.WinDef$LPARAM (referenced from: long com.jcraft.jsch.PageantConnector.sendMessage(com.sun.jna.platform.win32.WinDef$HWND, com.sun.jna.platform.win32.WinUser$COPYDATASTRUCT))
Missing class com.sun.jna.platform.win32.WinDef$LRESULT (referenced from: long com.jcraft.jsch.PageantConnector.sendMessage(com.sun.jna.platform.win32.WinDef$HWND, com.sun.jna.platform.win32.WinUser$COPYDATASTRUCT))
Missing class com.sun.jna.platform.win32.WinDef$WPARAM (referenced from: long com.jcraft.jsch.PageantConnector.sendMessage(com.sun.jna.platform.win32.WinDef$HWND, com.sun.jna.platform.win32.WinUser$COPYDATASTRUCT))
Missing class com.sun.jna.platform.win32.WinNT$HANDLE (referenced from: void com.jcraft.jsch.PageantConnector.query(com.jcraft.jsch.Buffer))
Missing class com.sun.jna.platform.win32.WinUser$COPYDATASTRUCT (referenced from: com.sun.jna.platform.win32.WinUser$COPYDATASTRUCT com.jcraft.jsch.PageantConnector.createCDS(java.lang.String) and 2 other contexts)
Missing class org.bouncycastle.crypto.BlockCipher (referenced from: void com.jcraft.jsch.bc.CAST128CBC.init(int, byte[], byte[]) and 4 other contexts)
Missing class org.bouncycastle.crypto.BufferedBlockCipher (referenced from: org.bouncycastle.crypto.BufferedBlockCipher com.jcraft.jsch.bc.CAST128CBC.cipher and 8 other contexts)
Missing class org.bouncycastle.crypto.CipherParameters (referenced from: void com.jcraft.jsch.bc.CAST128CBC.init(int, byte[], byte[]) and 8 other contexts)
Missing class org.bouncycastle.crypto.DefaultBufferedBlockCipher (referenced from: void com.jcraft.jsch.bc.CAST128CBC.init(int, byte[], byte[]) and 2 other contexts)
Missing class org.bouncycastle.crypto.Digest (referenced from: org.bouncycastle.crypto.Digest com.jcraft.jsch.bc.HMAC.digest and 1 other context)
Missing class org.bouncycastle.crypto.Signer (referenced from: org.bouncycastle.crypto.Signer com.jcraft.jsch.bc.SignatureEdDSA.signature and 5 other contexts)
Missing class org.bouncycastle.crypto.digests.RIPEMD160Digest (referenced from: void com.jcraft.jsch.bc.HMACRIPEMD160.<init>())
Missing class org.bouncycastle.crypto.engines.CAST5Engine (referenced from: void com.jcraft.jsch.bc.CAST128CBC.init(int, byte[], byte[]) and 1 other context)
Missing class org.bouncycastle.crypto.engines.ChaChaEngine (referenced from: org.bouncycastle.crypto.engines.ChaChaEngine com.jcraft.jsch.bc.ChaCha20Poly1305.header_cipher and 5 other contexts)
Missing class org.bouncycastle.crypto.engines.SEEDEngine (referenced from: void com.jcraft.jsch.bc.SEEDCBC.init(int, byte[], byte[]))
Missing class org.bouncycastle.crypto.engines.TwofishEngine (referenced from: void com.jcraft.jsch.bc.TwofishCBC.init(int, byte[], byte[]) and 1 other context)
Missing class org.bouncycastle.crypto.generators.Argon2BytesGenerator (referenced from: org.bouncycastle.crypto.generators.Argon2BytesGenerator com.jcraft.jsch.bc.Argon2.generator and 2 other contexts)
Missing class org.bouncycastle.crypto.generators.SCrypt (referenced from: byte[] com.jcraft.jsch.bc.SCrypt.getKey(byte[], int) and 1 other context)
Missing class org.bouncycastle.crypto.macs.HMac (referenced from: org.bouncycastle.crypto.macs.HMac com.jcraft.jsch.bc.HMAC.mac and 3 other contexts)
Missing class org.bouncycastle.crypto.macs.Poly1305 (referenced from: org.bouncycastle.crypto.macs.Poly1305 com.jcraft.jsch.bc.ChaCha20Poly1305.poly1305 and 3 other contexts)
Missing class org.bouncycastle.crypto.modes.CBCBlockCipher (referenced from: void com.jcraft.jsch.bc.CAST128CBC.init(int, byte[], byte[]) and 2 other contexts)
Missing class org.bouncycastle.crypto.modes.CBCModeCipher (referenced from: void com.jcraft.jsch.bc.CAST128CBC.init(int, byte[], byte[]) and 2 other contexts)
Missing class org.bouncycastle.crypto.modes.CTRModeCipher (referenced from: org.bouncycastle.crypto.modes.CTRModeCipher com.jcraft.jsch.bc.CAST128CTR.cipher and 5 other contexts)
Missing class org.bouncycastle.crypto.modes.SICBlockCipher (referenced from: void com.jcraft.jsch.bc.CAST128CTR.init(int, byte[], byte[]) and 1 other context)
Missing class org.bouncycastle.crypto.params.Argon2Parameters$Builder (referenced from: void com.jcraft.jsch.bc.Argon2.init(byte[], int, int, byte[], byte[], int, int, int))
Missing class org.bouncycastle.crypto.params.Argon2Parameters (referenced from: void com.jcraft.jsch.bc.Argon2.init(byte[], int, int, byte[], byte[], int, int, int))
Missing class org.bouncycastle.crypto.params.Ed25519PrivateKeyParameters (referenced from: void com.jcraft.jsch.bc.KeyPairGenEdDSA.init(java.lang.String, int) and 2 other contexts)
Missing class org.bouncycastle.crypto.params.Ed25519PublicKeyParameters (referenced from: void com.jcraft.jsch.bc.KeyPairGenEdDSA.init(java.lang.String, int) and 2 other contexts)
Missing class org.bouncycastle.crypto.params.Ed448PrivateKeyParameters (referenced from: void com.jcraft.jsch.bc.KeyPairGenEdDSA.init(java.lang.String, int) and 2 other contexts)
Missing class org.bouncycastle.crypto.params.Ed448PublicKeyParameters (referenced from: void com.jcraft.jsch.bc.KeyPairGenEdDSA.init(java.lang.String, int) and 2 other contexts)
Missing class org.bouncycastle.crypto.params.KeyParameter (referenced from: org.bouncycastle.crypto.params.KeyParameter com.jcraft.jsch.bc.ChaCha20Poly1305.K_1_spec and 9 other contexts)
Missing class org.bouncycastle.crypto.params.ParametersWithIV (referenced from: void com.jcraft.jsch.bc.CAST128CBC.init(int, byte[], byte[]) and 5 other contexts)
Missing class org.bouncycastle.crypto.params.X25519PrivateKeyParameters (referenced from: byte[] com.jcraft.jsch.bc.XDH.getSecret(byte[]) and 1 other context)
Missing class org.bouncycastle.crypto.params.X25519PublicKeyParameters (referenced from: byte[] com.jcraft.jsch.bc.XDH.getSecret(byte[]) and 1 other context)
Missing class org.bouncycastle.crypto.params.X448PrivateKeyParameters (referenced from: byte[] com.jcraft.jsch.bc.XDH.getSecret(byte[]) and 1 other context)
Missing class org.bouncycastle.crypto.params.X448PublicKeyParameters (referenced from: byte[] com.jcraft.jsch.bc.XDH.getSecret(byte[]) and 1 other context)
Missing class org.bouncycastle.crypto.signers.Ed25519Signer (referenced from: void com.jcraft.jsch.bc.SignatureEdDSA.init())
Missing class org.bouncycastle.crypto.signers.Ed448Signer (referenced from: void com.jcraft.jsch.bc.SignatureEdDSA.init())
Missing class org.newsclub.net.unix.AFUNIXServerSocketChannel (referenced from: java.nio.channels.ServerSocketChannel com.jcraft.jsch.JUnixSocketFactory.bind(java.nio.file.Path))
Missing class org.newsclub.net.unix.AFUNIXSocketAddress (referenced from: java.nio.channels.ServerSocketChannel com.jcraft.jsch.JUnixSocketFactory.bind(java.nio.file.Path) and 1 other context)
Missing class org.newsclub.net.unix.AFUNIXSocketChannel (referenced from: void com.jcraft.jsch.JUnixSocketFactory.<init>() and 1 other context)","sources":[{}],"tool":"R8"}

But there's no any issues when running on Android devices.
Should I ignore these warnings?
Is it necessary to add these two libraries?

implementation 'org.bouncycastle:bcprov-jdk18on:1.77'
implementation 'com.kohlschutter.junixsocket:junixsocket-core:2.1.1'
@norrisjeremy
Copy link
Contributor

Hi @KimiChiu,

I'm not especially familiar with Android development, but all these missing classes are for optional features in JSch.
I would not expect them to be required unless you use a feature in JSch that would require them:

  • All the com.sun.jna.* classes are only required to interface with Pageant (the SSH agent from the PuTTY project) on Windows platforms on all Java versions.
  • All the org.newsclub.net.unix.* classes are only required to interface with an SSH agent over a Unix domain socket on Java versions < 16.
  • All the org.bouncycastle.crypto.* classes are only required to utilize specific crypto algorithms unavailable in Java, or only introduced in specific Java versions.
    -- For the sntrup761x25519-sha512@openssh.com KEX algorithm: on all Java versions.
    -- For the curve25519-sha256, curve25519-sha256@libssh.org & curve448-sha512 KEX algorithms: on Java versions < 11.
    -- For the chacha20-poly1305@openssh.com Cipher algorithm: on all Java versions.
    -- For the cast128-cbc & cast128-ctr Cipher algorithms: on all Java versions.
    -- For the twofish-cbc, twofish128-cbc, twofish192-cbc, twofish256-cbc, twofish128-ctr, twofish192-ctr & twofish256-ctr Cipher algorithms: on all Java versions.
    -- For the seed-cbc@ssh.com Cipher algorithm: on all Java versions.
    -- For the hmac-ripemd160, hmac-ripemd160@openssh.com & hmac-ripemd160-etm@openssh.com MAC algorithms: on all Java versions.
    -- For the ssh-ed25519 & ssh-ed448 host key / user auth key algorithms: on Java versions < 15.
    -- For PuTTY v3 encrypted user auth keys using the Argon2 password KDF algorithm: on all Java versions.
    -- For PKCS#8 encrypted user auth keys using the Scrypt password KDF algorithm: on all Java versions.

Thanks,
Jeremy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants