Tabnine Logo
CryptoUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
CryptoUtil
in
org.jboss.aerogear.simplepush.util

Best Java code snippets using org.jboss.aerogear.simplepush.util.CryptoUtil (Showing top 7 results out of 315)

origin: aerogear/aerogear-simplepush-server

public static String endpointToken(final String uaid, final String channelId, final byte[] key) {
  try {
    final String path = uaid + "." + channelId;
    return encrypt(key, path);
  } catch (final Exception e) {
    throw new RuntimeException(e);
  }
}
origin: org.jboss.aerogear/aerogear-simplepush-server-core

private String generateEndpointToken(final String uaid, final String channelId) {
  return CryptoUtil.endpointToken(uaid, channelId, privateKey);
}
origin: aerogear/aerogear-simplepush-server

/**
 * Decrypts the content passed-in.
 *
 * @param key the key used for the underlying cypher.
 * @param content the content to decrypted.
 * @return {@code String} the descrypted content as a String.
 * @throws InvalidKeyException
 *
 * @throws Exception
 */
public static String decrypt(final byte[] key, final String content) throws Exception {
  final byte[] decodedContent = new UrlBase64().decode(URLDecoder.decode(content, ASCII.displayName()));
  final byte[] iv = extractIV(decodedContent);
  final byte[] decrypted = new CryptoBox(key).decrypt(iv, extractContent(decodedContent));
  return new String(decrypted, ASCII);
}
origin: org.jboss.aerogear/aerogear-simplepush-server-core

public static byte[] generateAndStorePrivateKey(final DataStore store, final SimplePushServerConfig config) {
  byte[] keySalt = store.getPrivateKeySalt();
  if (keySalt.length == 0) {
    keySalt = RandomUtils.randomBytes();
    store.savePrivateKeySalt(keySalt);
  }
  return CryptoUtil.secretKey(config.password(), keySalt);
}
origin: aerogear/aerogear-simplepush-server

/**
 * Encrypts the content passed-in.
 *
 * @param key the key used for the underlying cypher.
 * @param content the content to encrypted
 * @return {@code String} the encoded content as base64 url safe encoded string.
 *
 * @throws Exception
 */
public static String encrypt(final byte[] key, final String content) throws Exception {
  final byte[] iv = BlockCipher.getIV();
  final byte[] encrypted = new CryptoBox(key).encrypt(iv, content.getBytes(ASCII));
  final String base64 = new UrlBase64().encode(prependIV(encrypted, iv));
  return URLEncoder.encode(base64, ASCII.displayName());
}
origin: aerogear/aerogear-simplepush-server

public static byte[] generateAndStorePrivateKey(final DataStore store, final SimplePushServerConfig config) {
  byte[] keySalt = store.getPrivateKeySalt();
  if (keySalt.length == 0) {
    keySalt = RandomUtils.randomBytes();
    store.savePrivateKeySalt(keySalt);
  }
  return CryptoUtil.secretKey(config.password(), keySalt);
}
origin: aerogear/aerogear-simplepush-server

private String generateEndpointToken(final String uaid, final String channelId) {
  return CryptoUtil.endpointToken(uaid, channelId, privateKey);
}
org.jboss.aerogear.simplepush.utilCryptoUtil

Javadoc

Utility class for encrypting/decrypting

Most used methods

  • encrypt
    Encrypts the content passed-in.
  • endpointToken
  • extractContent
  • extractIV
  • prependIV
  • secretKey

Popular in Java

  • Creating JSON documents from java classes using gson
  • getContentResolver (Context)
  • addToBackStack (FragmentTransaction)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JPanel (javax.swing)
  • Top plugins for WebStorm
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