Tabnine Logo
CryptoEngine.generateSalt
Code IndexAdd Tabnine to your IDE (free)

How to use
generateSalt
method
in
com.oberasoftware.jasdb.api.security.CryptoEngine

Best Java code snippets using com.oberasoftware.jasdb.api.security.CryptoEngine.generateSalt (Showing top 3 results out of 315)

origin: oberasoftware/jasdb

private void createMandatoryAdminUser() throws JasDBStorageException {
  CryptoEngine cryptoEngine = CryptoFactory.getEngine();
  String salt = cryptoEngine.generateSalt();
  String contentKey = cryptoEngine.generateSalt();
  String encryptedContentKey = cryptoEngine.encrypt(salt, "", contentKey);
  User user = new UserMeta("admin", "localhost", encryptedContentKey, salt, cryptoEngine.hash(salt, ""), cryptoEngine.getDescriptor());
  userMetadataProvider.addUser(user);
  Grant grant = new GrantMeta("admin", AccessMode.ADMIN);
  GrantObjectMeta grantsMeta = new GrantObjectMeta(Constants.OBJECT_SEPARATOR, grant);
  String unencryptedGrants = SimpleEntity.toJson(GrantObjectMeta.toEntity(grantsMeta));
  String encryptedGrants = cryptoEngine.encrypt(salt, contentKey, unencryptedGrants);
  EncryptedGrants grants = new EncryptedGrants(grantsMeta.getObjectName(), encryptedGrants, salt, cryptoEngine.getDescriptor());
  grantMetadataProvider.persistGrant(grants);
}
origin: oberasoftware/jasdb

  @Override
  public User addUser(String userName, String allowedHost, String contentKey, String password) throws JasDBStorageException {
    if(!userMetadataProvider.hasUser(userName)) {
      CryptoEngine cryptoEngine = CryptoFactory.getEngine();
      String salt = cryptoEngine.generateSalt();
      String encryptedContentKey = cryptoEngine.encrypt(salt, password, contentKey);
      String passwordHash = cryptoEngine.hash(salt, password);

      User user = new UserMeta(userName, allowedHost, encryptedContentKey, salt, passwordHash, cryptoEngine.getDescriptor());
      userMetadataProvider.addUser(user);
      return user;
    } else {
      return userMetadataProvider.getUser(userName);
    }
  }
}
origin: oberasoftware/jasdb

private EncryptedGrants encryptGrants(GrantObject grantObject, UserSession userSession) throws JasDBStorageException {
  CryptoEngine cryptoEngine = CryptoFactory.getEngine();
  String contentKey = CryptoFactory.getEngine().decrypt(userSession.getUser().getPasswordSalt(), userSession.getAccessToken(), userSession.getEncryptedContentKey());
  String salt = cryptoEngine.generateSalt();
  String unencryptedData = SimpleEntity.toJson(GrantObjectMeta.toEntity(grantObject));
  String encryptedData = cryptoEngine.encrypt(salt, contentKey, unencryptedData);
  return new EncryptedGrants(grantObject.getObjectName(), encryptedData, salt, cryptoEngine.getDescriptor());
}
com.oberasoftware.jasdb.api.securityCryptoEnginegenerateSalt

Popular methods of CryptoEngine

  • hash
  • decrypt
  • encrypt
  • getDescriptor

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • getExternalFilesDir (Context)
  • getSystemService (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Menu (java.awt)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • JPanel (javax.swing)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now