Class SerialStrings

  • All Implemented Interfaces:
    Serializable

    public class SerialStrings
    extends Object
    implements Serializable
    Utility for managing/manipulating serial strings. Note that since this is only for managing serial strings, the prefix resolution should include the entire serial string, e.g.



    http://cilogon.org/serverA/user/delegation2/ ----> A



    rather than just the server name.

    Created by Jeff Gaynor
    on 3/1/12 at 2:00 PM

    See Also:
    Serialized Form
    • Constructor Detail

      • SerialStrings

        public SerialStrings​(edu.uiuc.ncsa.security.core.util.DoubleHashMap<URI,​String> prefixMap)
    • Method Detail

      • toSerialString

        public String toSerialString​(edu.uiuc.ncsa.security.core.Identifier x)
        Converts a uri to a serial string by replacing the head of it with a given prefix. Note that the result is not a uri. E.g.

        toSerialString(URI.create("https://my.org/foo/222)) would, assuming that https://my.org/foo is associated with the prefix "A" return

        A222

        The syntax of serial strings never varies: letters + digits, and the letters are just the prefix. This is how we isomorphically map uris to certificate serial strings.
        Parameters:
        x -
        Returns:
      • fromSerialString

        public URI fromSerialString​(String x)
        Takes a serial string, e.g. A123 and converts it to the prefixed form, e.g. A:123. This can be resolved into the correct namespace.
        Parameters:
        x -
        Returns:
      • mungePrefix

        public URI mungePrefix​(URI prefix,
                               URI target)
        Replaces the head part of a URI with the prefix.

        E.g. if xmlns:a=http://www.qqq.com/fnord

        then mungePrefix("a", http://www.qqq.com/fnord, http://www.qqq.com/fnord/fnibble); returns

        a:fnibble

        Parameters:
        prefix -
        target -
        Returns:
      • demungePrefix

        public URI demungePrefix​(URI prefix,
                                 URI target)
        Undoes what mungePrefix( java.net.URI, java.net.URI) does.

        E.g. demungePrefix("http://foo/bar/baz", "A:321"); (the arguments are actuall URIs!) then this would return

        http://foo/bar/baz/321

        Note that this requires the prefix so this is just attending to the details of replacing the prefix, not looking it up or something else. Also note the added / before the argument!
        Parameters:
        prefix -
        target -
        Returns: