Class ScramStringFormatting


  • public class ScramStringFormatting
    extends java.lang.Object
    Class with static methods that provide support for converting to/from salNames.
    See Also:
    [RFC5802] Section 7: Formal Syntax
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] base64Decode​(java.lang.String value)  
      static java.lang.String base64Encode​(byte[] value)  
      static java.lang.String base64Encode​(java.lang.String value)  
      static java.lang.String fromSaslName​(java.lang.String value)
      Given a saslName, return a non-escaped String.
      static java.lang.String toSaslName​(java.lang.String value)
      Given a value-safe-char (normalized UTF-8 String), return one where characters ',' and '=' are represented by '=2C' or '=3D', respectively.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScramStringFormatting

        public ScramStringFormatting()
    • Method Detail

      • toSaslName

        public static java.lang.String toSaslName​(java.lang.String value)
        Given a value-safe-char (normalized UTF-8 String), return one where characters ',' and '=' are represented by '=2C' or '=3D', respectively.
        Parameters:
        value - The value to convert so saslName
        Returns:
        The saslName, with caracter escaped (if any)
      • fromSaslName

        public static java.lang.String fromSaslName​(java.lang.String value)
                                             throws java.lang.IllegalArgumentException
        Given a saslName, return a non-escaped String.
        Parameters:
        value - The saslName
        Returns:
        The saslName, unescaped
        Throws:
        java.lang.IllegalArgumentException - If a ',' character is present, or a '=' not followed by either '2C' or '3D'
      • base64Encode

        public static java.lang.String base64Encode​(byte[] value)
                                             throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • base64Encode

        public static java.lang.String base64Encode​(java.lang.String value)
                                             throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException
      • base64Decode

        public static byte[] base64Decode​(java.lang.String value)
                                   throws java.lang.IllegalArgumentException
        Throws:
        java.lang.IllegalArgumentException