Package org.platformlayer.auth.crypto

Examples of org.platformlayer.auth.crypto.SecretStore$Writer


   *
   * @param context
   * @return
   */
  private static GeneratorResult execute(String grammarFile, final boolean forwardRef) {
    final Writer writer = new PrintWriter();
   
    // TODO: Fix this!
    ParsingSettings parsingSettings = new ParsingSettings() {
      @Override
      public boolean isForwardRef() {
        return forwardRef;
      }
    };
    grammarFile = Util.replaceSlash(grammarFile);
   
    writer.writeln("  Reading grammar \"" + grammarFile + "\"");
   
    GrammarParser parser = new GrammarParser(new IGrammarFactoryFactory() {
      public IGrammarFactory getFactory(int phase) {
        return new ParserFactory(writer);
      }}
View Full Code Here


    ProjectEntity project = userRepository.findProjectByKey(projectKey.getKey());
    if (project == null) {
      throw new CliException("Project not found: " + projectKey.getKey());
    }

    SecretStore secretStore = new SecretStore(project.secretData);
    CryptoKey projectSecret = secretStore.getSecretFromUser(me);
    if (projectSecret == null) {
      String msg = "Cannot retrieve project secret.";
      msg += " Is " + me.key + " a member of " + project.getName() + "?";
      throw new CliException(msg);
    }
View Full Code Here

    }
    return userSecret;
  }

  public CryptoKey unlockWithPassword(String password) {
    SecretStore secretStore = new SecretStore(secret);
    this.userSecret = secretStore.getSecretFromPassword(id, password);
    if (this.userSecret == null) {
      throw new SecurityException();
    }
    return this.userSecret;
  }
View Full Code Here

  public int getId() {
    return id;
  }

  public byte[] findChallenge(X509Certificate[] certificateChain) {
    SecretStore secretStore = new SecretStore(secret);
    return secretStore.findChallengeForCertificate(certificateChain);
  }
View Full Code Here

    }
    return projectSecret;
  }

  public void unlockWithUser(UserEntity user) {
    SecretStore secretStore = new SecretStore(this.secretData);
    this.projectSecret = secretStore.getSecretFromUser(user);
    if (this.projectSecret == null) {
      throw new SecurityException();
    }
  }
View Full Code Here

      throw new SecurityException();
    }
  }

  public void unlockWithProject(ProjectEntity project) {
    SecretStore secretStore = new SecretStore(this.secretData);
    this.projectSecret = secretStore.getSecretFromProject(project);
    if (this.projectSecret == null) {
      throw new SecurityException();
    }
  }
View Full Code Here

      PublicKey userPublicKey = user.getPublicKey();

      byte[] newSecretData;
      try {
        SecretStore store = new SecretStore(project.secretData);
        Writer writer = store.buildWriter();
        writer.writeAsymetricUserKey(projectSecretData, user.id, userPublicKey);
        writer.close();
        store.appendContents(writer);

        newSecretData = store.getEncoded();
      } catch (IOException e) {
        throw new RepositoryException("Error writing secrets", e);
      }

      db.updateProjectSecret(project.id, newSecretData);
View Full Code Here

      PublicKey grantToProjectPublicKey = grantToProject.getPublicKey();

      byte[] newSecretData;
      try {
        SecretStore store = new SecretStore(onProject.secretData);
        Writer writer = store.buildWriter();
        writer.writeAsymetricProjectKey(projectSecretData, grantToProject.id, grantToProjectPublicKey);
        writer.close();
        store.appendContents(writer);

        newSecretData = store.getEncoded();
      } catch (IOException e) {
        throw new RepositoryException("Error writing secrets", e);
      }

      db.updateProjectSecret(onProject.id, newSecretData);
View Full Code Here

  //
  // return FathomdbCrypto.decrypt(secretKey, data);
  // }

  public CryptoKey getSecret(byte[] secret) {
    SecretStore secretStore = new SecretStore(secret);

    CryptoKey secretKey = null;

    for (ProjectAuthorization project : OpsContext.get().getEncryptingProjects()) {
      secretKey = secretStore.getSecretFromProject(project);
      if (secretKey != null) {
        break;
      }
    }
View Full Code Here

      readers[i]=new Reader(pricesInfo);
      threadsReader[i]=new Thread(readers[i]);
    }
   
    // Creates a writer and a thread to run it
    Writer writer=new Writer(pricesInfo);
    Thread threadWriter=new Thread(writer);
   
    // Starts the threads
    for (int i=0; i<5; i++){
      threadsReader[i].start();
View Full Code Here

TOP

Related Classes of org.platformlayer.auth.crypto.SecretStore$Writer

Copyright © 2018 www.massapicom. 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.