Examples of HashAlgorithm


Examples of edu.stanford.bmir.protege.web.client.ui.login.HashAlgorithm

        String newPasswordConfirmation = data.getNewPasswordConfirmation();
        return newPassword.equals(newPasswordConfirmation);
    }

    protected void doCurrentPasswordValidation(LoginChallengeData result, final ChangePasswordData data, final WebProtegeDialogCloser closer) {
        final HashAlgorithm hashAlgorithm = new HashAlgorithm();
        final String saltedHashedPass = hashAlgorithm.md5(result.getSalt() + data.getOldPassword());
        final String response = hashAlgorithm.md5(result.getChallenge() + saltedHashedPass);
        AdminServiceManager.getInstance().authenticateToLogin(userId, response, new AsyncCallback<UserId>() {
            public void onSuccess(UserId userData) {
                if (!userData.isGuest()) {
                    doGetSaltForNewPassword(data, closer);
                } else {
View Full Code Here

Examples of edu.stanford.bmir.protege.web.client.ui.login.HashAlgorithm

            }
        });
    }

    private void doChangePassword(String salt, ChangePasswordData data, final WebProtegeDialogCloser closer) {
        final HashAlgorithm hashAlgorithm = new HashAlgorithm();
        String saltedHashedNewPass = hashAlgorithm.md5(salt + data.getNewPassword());
        AdminServiceManager.getInstance().changePasswordEncrypted(userId, saltedHashedNewPass, salt, new AsyncCallback<Boolean>() {
            public void onSuccess(Boolean result) {
                if (result) {
                    closer.hide();
                    handleSuccess();
View Full Code Here

Examples of edu.stanford.bmir.protege.web.client.ui.login.HashAlgorithm

        if (newUserPassword.contentEquals(newUserPassword2)) {
            win.getEl().mask("Creating new user...", true);
            AdminServiceManager.getInstance().getNewSalt(new AsyncCallback<String>() {

                public void onSuccess(String salt) {
                    HashAlgorithm hAlgorithm = new HashAlgorithm();
                    String saltedHashedPass = hAlgorithm.md5(salt + newUserPassword);

                    OpenIdServiceManager.getInstance().registerUserToAssocOpenIdWithEncrption(userName, saltedHashedPass,
                            emailId, new AsyncCallback<UserData>() {

                                public void onSuccess(UserData userData) {
View Full Code Here

Examples of edu.stanford.bmir.protege.web.client.ui.login.HashAlgorithm

        @Override
        public void handleSuccess(LoginChallengeData result) {

            if (result != null) {
                HashAlgorithm hAlgorithm = new HashAlgorithm();
                String saltedHashedPass = hAlgorithm.md5(result.getSalt() + passField.getText());
                String response = hAlgorithm.md5(result.getChallenge() + saltedHashedPass);
                OpenIdServiceManager.getInstance().validateUserToAssocOpenIdWithEncrypt(userName, response,
                        new AsyncCallback<UserData>() {

                            public void onSuccess(UserData userData) {
                                win.getEl().unmask();
View Full Code Here

Examples of edu.stanford.bmir.protege.web.client.ui.login.HashAlgorithm

                        "There was a problem registering the specified user account. " +
                                "Please contact admin. (Problem " + caught.getMessage() + ")");
            }

            public void onSuccess(String salt) {
                HashAlgorithm hashAlgorithm = new HashAlgorithm();
                String userName = data.getUserName();
                String email = data.getEmailAddress().getEmailAddress();
                String hashedPassword = hashAlgorithm.md5(salt + data.getPassword());
                adminServiceManager.registerUserViaEncrption(userName, hashedPassword, email, new AsyncCallback<UserData>() {
                    public void onFailure(Throwable caught) {
                        if(caught instanceof UserNameAlreadyExistsException) {
                            String username = ((UserNameAlreadyExistsException) caught).getUsername();
                            MessageBox.showAlert("User name already taken", "A user named "
View Full Code Here

Examples of edu.stanford.bmir.protege.web.client.ui.login.HashAlgorithm

        if (newUserPassword.contentEquals(newUserPassword2)) {
            win.getEl().mask("Creating new user...", true);
            AdminServiceManager.getInstance().getNewSalt(new AsyncCallback<String>() {

                public void onSuccess(String salt) {
                    HashAlgorithm hAlgorithm = new HashAlgorithm();
                    String saltedHashedPass = hAlgorithm.md5(salt + newUserPassword);
                    AccessPolicyServiceManager.getInstance().updateInvitedTemporaryAccount(userName, saltedHashedPass, emailId,  new UpdateInvitedTemporaryAccountHandler(win));
                }

                public void onFailure(Throwable caught) {
                    MessageBox.showAlert(AuthenticationConstants.ASYNCHRONOUS_CALL_FAILURE_MESSAGE);
View Full Code Here

Examples of net.sf.jsignpdf.types.HashAlgorithm

      }

      options.log("console.createOutPdf", outFile);
      fout = new FileOutputStream(outFile);

      final HashAlgorithm hashAlgorithm = options.getHashAlgorithmX();

      options.log("console.createSignature");
      char tmpPdfVersion = '\0'; // default version - the same as input
      if (reader.getPdfVersion() < hashAlgorithm.getPdfVersion()) {
        tmpPdfVersion = hashAlgorithm.getPdfVersion();
        options.log("console.updateVersion", new String[] { String.valueOf(reader.getPdfVersion()),
            String.valueOf(tmpPdfVersion) });
      }
      final PdfStamper stp = PdfStamper.createSignature(reader, fout, tmpPdfVersion, null, options.isAppendX());
      if (!options.isAppendX()) {
        // we are not in append mode, let's remove existing signatures
        // (otherwise we're getting to troubles)
        final AcroFields acroFields = stp.getAcroFields();
        final List<String> sigNames = acroFields.getSignatureNames();
        for (String sigName : sigNames) {
          acroFields.removeField(sigName);
        }
      }
      if (options.isEncryptedX()) {
        options.log("console.setEncryption");
        final int tmpRight = options.getRightPrinting().getRight()
            | (options.isRightCopy() ? PdfWriter.ALLOW_COPY : 0)
            | (options.isRightAssembly() ? PdfWriter.ALLOW_ASSEMBLY : 0)
            | (options.isRightFillIn() ? PdfWriter.ALLOW_FILL_IN : 0)
            | (options.isRightScreanReaders() ? PdfWriter.ALLOW_SCREENREADERS : 0)
            | (options.isRightModifyAnnotations() ? PdfWriter.ALLOW_MODIFY_ANNOTATIONS : 0)
            | (options.isRightModifyContents() ? PdfWriter.ALLOW_MODIFY_CONTENTS : 0);
        stp.setEncryption(true, options.getPdfUserPwdStr(), options.getPdfOwnerPwdStr(), tmpRight);
      }

      final PdfSignatureAppearance sap = stp.getSignatureAppearance();
      sap.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED);
      if (!StringUtils.isEmpty(options.getReason())) {
        options.log("console.setReason", options.getReason());
        sap.setReason(options.getReason());
      }
      if (!StringUtils.isEmpty(options.getLocation())) {
        options.log("console.setLocation", options.getLocation());
        sap.setLocation(options.getLocation());
      }
      if (!StringUtils.isEmpty(options.getContact())) {
        options.log("console.setContact", options.getContact());
        sap.setContact(options.getContact());
      }
      options.log("console.setCertificationLevel");
      sap.setCertificationLevel(options.getCertLevelX().getLevel());

      if (options.isVisible()) {
        // visible signature is enabled
        options.log("console.configureVisible");
        options.log("console.setAcro6Layers");
        sap.setAcro6Layers(true);

        final String tmpImgPath = options.getImgPath();
        if (tmpImgPath != null) {
          options.log("console.createImage", tmpImgPath);
          final Image img = Image.getInstance(tmpImgPath);
          options.log("console.setSignatureGraphic");
          sap.setSignatureGraphic(img);
        }
        final String tmpBgImgPath = options.getBgImgPath();
        if (tmpBgImgPath != null) {
          options.log("console.createImage", tmpBgImgPath);
          final Image img = Image.getInstance(tmpBgImgPath);
          options.log("console.setImage");
          sap.setImage(img);
        }
        options.log("console.setImageScale");
        sap.setImageScale(options.getBgImgScale());
        options.log("console.setL2Text");
        if (options.getL2Text() != null) {
          sap.setLayer2Text(options.getL2Text());
        } else {
          final StringBuilder buf = new StringBuilder();
          buf.append(res.get("default.l2text.signedBy")).append(" ");
          buf.append(PdfPKCS7.getSubjectFields((X509Certificate) chain[0]).getField("CN")).append('\n');
          final SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss z");
          buf.append(res.get("default.l2text.date")).append(" ").append(
              sd.format(sap.getSignDate().getTime()));
          if (StringUtils.hasLength(options.getReason()))
            buf.append('\n').append(res.get("default.l2text.reason")).append(" ").append(
                options.getReason());
          if (StringUtils.hasLength(options.getLocation()))
            buf.append('\n').append(res.get("default.l2text.location")).append(" ").append(
                options.getLocation());
          sap.setLayer2Text(buf.toString());
          ;
        }
        if (FontUtils.getL2BaseFont() != null) {
          sap.setLayer2Font(new Font(FontUtils.getL2BaseFont(), options.getL2TextFontSize()));
        }
        options.log("console.setL4Text");
        sap.setLayer4Text(options.getL4Text());
        options.log("console.setRender");
        sap.setRender(options.getRenderMode().getRender());
        options.log("console.setVisibleSignature");
        sap.setVisibleSignature(new Rectangle(options.getPositionLLX(), options.getPositionLLY(), options
            .getPositionURX(), options.getPositionURY()), options.getPage(), null);
      }

      options.log("console.processing");
      final PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, new PdfName("adbe.pkcs7.detached"));
      dic.setReason(sap.getReason());
      dic.setLocation(sap.getLocation());
      dic.setContact(sap.getContact());
      dic.setDate(new PdfDate(sap.getSignDate()));
      sap.setCryptoDictionary(dic);

      final Proxy tmpProxy = options.createProxy();

      final CRLInfo crlInfo = new CRLInfo(options, chain);

      // CRLs are stored twice in PDF c.f.
      // PdfPKCS7.getAuthenticatedAttributeBytes
      final int contentEstimated = (int) (Constants.DEFVAL_SIG_SIZE + 2L * crlInfo.getByteCount());
      HashMap exc = new HashMap();
      exc.put(PdfName.CONTENTS, new Integer(contentEstimated * 2 + 2));
      sap.preClose(exc);

      PdfPKCS7 sgn = new PdfPKCS7(key, chain, crlInfo.getCrls(), hashAlgorithm.getAlgorithmName(), null, false);
      InputStream data = sap.getRangeStream();
      final MessageDigest messageDigest = MessageDigest.getInstance(hashAlgorithm.getAlgorithmName());
      byte buf[] = new byte[8192];
      int n;
      while ((n = data.read(buf)) > 0) {
        messageDigest.update(buf, 0, n);
      }
View Full Code Here

Examples of net.spy.memcached.HashAlgorithm

    throws JSONException {
    final JSONObject vBucketServerMap =
      source.getJSONObject("vBucketServerMap");

    final String algorithm = vBucketServerMap.getString("hashAlgorithm");
    HashAlgorithm hashAlgorithm =
      HashAlgorithmRegistry.lookupHashAlgorithm(algorithm);
    if (hashAlgorithm == null) {
      throw new IllegalArgumentException("Unhandled hash algorithm type: "
          + algorithm);
    }
View Full Code Here

Examples of net.spy.memcached.HashAlgorithm

    throws JSONException {
    final JSONObject vBucketServerMap =
      source.getJSONObject("vBucketServerMap");

    final String algorithm = vBucketServerMap.getString("hashAlgorithm");
    HashAlgorithm hashAlgorithm =
      HashAlgorithmRegistry.lookupHashAlgorithm(algorithm);
    if (hashAlgorithm == null) {
      throw new IllegalArgumentException("Unhandled hash algorithm type: "
          + algorithm);
    }
View Full Code Here

Examples of net.spy.memcached.HashAlgorithm

  /* ep is for ep-engine, a.k.a. couchbase */
  private Config parseEpJSON(JSONObject jsonObject) throws JSONException {
    JSONObject vbMap = jsonObject.getJSONObject("vBucketServerMap");
    String algorithm = vbMap.getString("hashAlgorithm");
    HashAlgorithm hashAlgorithm =
        HashAlgorithmRegistry.lookupHashAlgorithm(algorithm);
    if (hashAlgorithm == null) {
      throw new IllegalArgumentException("Unhandled hash algorithm type: "
          + algorithm);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.