code: public void setAlgorithm(KeyAgreementType dh) 
  	{
  		log("DH algorithm set: " + getDHName(dhMode) + " -> " + getDHName(dh));
  		try {
  			if(dhMode != null && dh.keyType == dhMode.keyType) return;
  			dhMode = dh;
  			switch (dhMode.keyType) {
  		        case KeyAgreementType.DH_MODE_DH3K:
  		    		DHParameterSpec paramSpec = new DHParameterSpec(dhP, dhG, DH_EXP_LENGTH);
  		    		dhKeyGen = KeyPairGenerator.getInstance(ALGORITHM_DH);
  		    		dhKeyGen.initialize(paramSpec, sr);
  		    		dhKeyPair = dhKeyGen.generateKeyPair();
  		    		clearEcdh();
  		    		break;
  		        case KeyAgreementType.DH_MODE_EC25:
  		        	setupEC(256);
  			        break;
  		        case KeyAgreementType.DH_MODE_EC38:
  		        default:
  		        	setupEC(384);
  			        break;
  	        }
  		} catch (Exception e) {
  	        // TODO Auto-generated catch block
  	        e.printStackTrace();
  	        throw new RuntimeException("Failed init Diffie-Hellman: " + e.getClass().getName() + ": " + e.getMessage() + ", bitlength p = " + dhP.bitCount());
          }
  	}
docs: DH3K RIM implementation is currently buggy and DOES NOT WORK!!!