Omemo encryption fails

Hi, when I’m trying to encrypt a message with OMEMO I receive this exception, anybody experienced this before?

  • Smack version: 4.4.1
- Exception in thread "main" org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException: java.security.InvalidAlgorithmParameterException: Unsupported parameter: javax.crypto.spec.IvParameterSpec@53bd8fca
	at org.jivesoftware.smackx.omemo.OmemoService.encrypt(OmemoService.java:374)
	at org.jivesoftware.smackx.omemo.OmemoService.createOmemoMessage(OmemoService.java:542)
	at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:340)
	at org.jivesoftware.smackx.omemo.OmemoManager.encrypt(OmemoManager.java:313)
	at de.suas.itsec.Messenger.handleInput(Messenger.java:160)
	at de.suas.itsec.Messenger.main(Messenger.java:64)
Caused by: java.security.InvalidAlgorithmParameterException: Unsupported parameter: javax.crypto.spec.IvParameterSpec@53bd8fca
	at java.base/com.sun.crypto.provider.CipherCore.init(CipherCore.java:520)
	at java.base/com.sun.crypto.provider.AESCipher.engineInit(AESCipher.java:346)
	at java.base/javax.crypto.Cipher.implInit(Cipher.java:871)
	at java.base/javax.crypto.Cipher.chooseProvider(Cipher.java:929)
	at java.base/javax.crypto.Cipher.init(Cipher.java:1444)
	at java.base/javax.crypto.Cipher.init(Cipher.java:1375)
	at org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder.setMessage(OmemoMessageBuilder.java:165)
	at org.jivesoftware.smackx.omemo.util.OmemoMessageBuilder.<init>(OmemoMessageBuilder.java:112)
	at org.jivesoftware.smackx.omemo.OmemoService.encrypt(OmemoService.java:371)
	... 5 more

\

  try {
          String secret = "Mallory is a twerp!";
         OmemoManager.getInstanceFor(connection).encrypt(recipientJid.asBareJid(), secret);
        
  }  catch (UndecidedOmemoIdentityException e) {
                        System.out.println("Undecided Identities: ");
                        for (OmemoDevice device : e.getUndecidedDevices()) {
                            System.out.println(device);
                        }
                    }

Do you have bouncycastle configured?

I don’t think so, is it something required?

A security provider that provides the “AES/GCM/NoPadding” cipher is required, yes. Bouncycastle contains such a provider.

1 Like

I didn’t know about that before, now it’s working thanks a lot for your time

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.