org.opensaml.artifact
Class Util

java.lang.Object
  extended by org.opensaml.artifact.Util

public final class Util
extends Object

An artifact utility class.

Author:
Tom Scavo

Method Summary
static byte[] concat(byte[] left_bytes, byte[] right_bytes)
          Concatenate two byte arrays.
static byte[] generateSourceId(MessageDigest md, String s)
          Generate a sourceId from the given string using the given MessageDigest object.
static byte[] generateSourceId(String s)
          Generate a sourceId from the given string.
static byte[] generateSourceId(URI providerId)
          A convenience method to generate a sourceId from the given providerId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

generateSourceId

public static byte[] generateSourceId(MessageDigest md,
                                      String s)

Generate a sourceId from the given string using the given MessageDigest object.

Parameters:
md - a MessageDigest object
s - an arbitrary string
Returns:
the SHA-1 hash of the string or null if either argument is null
See Also:
MessageDigest

generateSourceId

public static byte[] generateSourceId(String s)
                               throws NoSuchAlgorithmException

Generate a sourceId from the given string. Instantiate a local MessageDigest object as needed.

Parameters:
s - an arbitrary string
Returns:
the SHA-1 hash of the string
Throws:
NoSuchAlgorithmException - if the Java implementation does not support the "SHA-1" hash algorithm.
See Also:
MessageDigest

generateSourceId

public static byte[] generateSourceId(URI providerId)
                               throws NoSuchAlgorithmException

A convenience method to generate a sourceId from the given providerId. The URI is simply converted to a string before it is hashed.

Parameters:
providerId - the providerId of the artifact issuer
Returns:
the SHA-1 hash of the providerId or null if the argument is null
Throws:
NoSuchAlgorithmException - if the Java implementation does not support the "SHA-1" hash algorithm.
See Also:
MessageDigest

concat

public static byte[] concat(byte[] left_bytes,
                            byte[] right_bytes)
Concatenate two byte arrays.

Parameters:
left_bytes - An array of bytes.
right_bytes - Another array of bytes.
Returns:
Yet another byte array, the concatenation of the given byte arrays.


Copyright ? 2005 UCAID. All Rights Reserved.