protected void engineInit(final Map attributes) throws KeyAgreementException {
      rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS);
      N = (BigInteger) attributes.get(SHARED_MODULUS);
      if (N == null) {
         throw new KeyAgreementException("missing shared modulus");
      }
      g = (BigInteger) attributes.get(GENERATOR);
      if (g == null) {
         throw new KeyAgreementException("missing generator");
      }

      final String md = (String) attributes.get(HASH_FUNCTION);
      if (md == null || "".equals(md.trim())) {
         throw new KeyAgreementException("missing hash function");
      }
      srp = SRP.instance(md);

      passwordDB = (SRPAuthInfoProvider) attributes.get(HOST_PASSWORD_DB);
      if (passwordDB == null) {
         throw new KeyAgreementException("missing SRP password database");
      }
   }