congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
org.springframework.security.crypto.codec
Code IndexAdd Tabnine to your IDE (free)

How to use org.springframework.security.crypto.codec

Best Java code snippets using org.springframework.security.crypto.codec (Showing top 20 results out of 414)

origin: spring-projects/spring-security

private static byte[] bytesUtf8(String s) {
  if (s == null) {
    return null;
  }
  return Utf8.encode(s); // need to check if Utf8.encode() runs in constant time (probably not). This may leak length of string.
}
origin: spring-projects/spring-security

public static boolean isBase64(byte[] bytes) {
  try {
    decode(bytes);
  }
  catch (InvalidBase64CharacterException e) {
    return false;
  }
  return true;
}
origin: spring-projects/spring-security

public static byte[] encode(byte[] bytes) {
  return encodeBytesToBytes(bytes, 0, bytes.length, NO_OPTIONS);
}
origin: spring-projects/spring-security

private String encode(byte[] digest) {
  if (this.encodeHashAsBase64) {
    return Utf8.decode(Base64.getEncoder().encode(digest));
  }
  else {
    return new String(Hex.encode(digest));
  }
}
origin: spring-projects/spring-security

public String encrypt(String text) {
  return new String(Hex.encode(encryptor.encrypt(Utf8.encode(text))));
}
origin: spring-projects/spring-security

public String decrypt(String encryptedText) {
  return Utf8.decode(encryptor.decrypt(Hex.decode(encryptedText)));
}
origin: spring-projects/spring-security

private byte[] decode(CharSequence encodedPassword) {
  return Hex.decode(encodedPassword);
}
origin: spring-projects/spring-security

  @Test(expected = IllegalArgumentException.class)
  public void isBase64RejectsInvalidLength() {
    Base64.isBase64(new byte[] { (byte) 'A' });
  }
}
origin: spring-projects/spring-security

private String encode(byte[] digest) {
  if (this.encodeHashAsBase64) {
    return Utf8.decode(Base64.getEncoder().encode(digest));
  }
  else {
    return new String(Hex.encode(digest));
  }
}
origin: spring-projects/spring-security

public static byte[] decode(byte[] bytes) {
  return decode(bytes, 0, bytes.length, NO_OPTIONS);
}
origin: org.springframework.security/spring-security-core

public String decrypt(String encryptedText) {
  return Utf8.decode(encryptor.decrypt(Hex.decode(encryptedText)));
}
origin: spring-projects/spring-security

/**
 * Constructs a standard password encoder with a secret value as well as iterations
 * and hash.
 *
 * @param secret the secret
 * @param iterations the number of iterations. Users should aim for taking about .5
 * seconds on their own system.
 * @param hashWidth the size of the hash
 */
public Pbkdf2PasswordEncoder(CharSequence secret, int iterations, int hashWidth) {
  this.secret = Utf8.encode(secret);
  this.iterations = iterations;
  this.hashWidth = hashWidth;
}
origin: org.springframework.security/spring-security-core

private byte[] decode(CharSequence encodedPassword) {
  return Hex.decode(encodedPassword);
}
origin: org.springframework.security/spring-security-core

public static byte[] encode(byte[] bytes) {
  return encodeBytesToBytes(bytes, 0, bytes.length, NO_OPTIONS);
}
origin: spring-projects/spring-security

@Test(expected = NullPointerException.class)
public void isBase64RejectsNull() {
  Base64.isBase64(null);
}
origin: org.springframework.security/spring-security-core

private String encode(byte[] digest) {
  if (this.encodeHashAsBase64) {
    return Utf8.decode(Base64.getEncoder().encode(digest));
  }
  else {
    return new String(Hex.encode(digest));
  }
}
origin: org.springframework.security/spring-security-core

public static boolean isBase64(byte[] bytes) {
  try {
    decode(bytes);
  }
  catch (InvalidBase64CharacterException e) {
    return false;
  }
  return true;
}
origin: org.springframework.security/spring-security-core

private static byte[] bytesUtf8(String s) {
  if (s == null) {
    return null;
  }
  return Utf8.encode(s); // need to check if Utf8.encode() runs in constant time (probably not). This may leak length of string.
}
origin: org.springframework.security/spring-security-core

public static byte[] decode(byte[] bytes) {
  return decode(bytes, 0, bytes.length, NO_OPTIONS);
}
origin: org.springframework.security/spring-security-core

/**
 * Constructs a standard password encoder with a secret value as well as iterations
 * and hash.
 *
 * @param secret the secret
 * @param iterations the number of iterations. Users should aim for taking about .5
 * seconds on their own system.
 * @param hashWidth the size of the hash
 */
public Pbkdf2PasswordEncoder(CharSequence secret, int iterations, int hashWidth) {
  this.secret = Utf8.encode(secret);
  this.iterations = iterations;
  this.hashWidth = hashWidth;
}
org.springframework.security.crypto.codec

Most used classes

  • Base64
    Base64 encoder which is a reduced version of Robert Harder's public domain implementation (version 2
  • Hex
    Hex data encoder. Converts byte arrays (such as those obtained from message digests) into hexadecima
  • Utf8
    UTF-8 Charset encoder/decoder. For internal use only.
  • InvalidBase64CharacterException
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