dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * CDDL HEADER START
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * The contents of this file are subject to the terms of the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Common Development and Distribution License, Version 1.0 only
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * (the "License"). You may not use this file except in compliance
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * with the License.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * or http://www.opensolaris.org/os/licensing.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * See the License for the specific language governing permissions
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * and limitations under the License.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * When distributing Covered Code, include this CDDL HEADER in each
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * If applicable, add the following below this CDDL HEADER, with the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * fields enclosed by brackets "[]" replaced with your own identifying
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * information: Portions Copyright [yyyy] [name of copyright owner]
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * CDDL HEADER END
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * ident "%Z%%M% %I% %E% SMI"
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Copyright (c) 1999 by Sun Microsystems, Inc.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * All rights reserved.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * The AuthBlock class models both the client and server side
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * authentication blocks.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * AuthBlocks are agnostic as to which components from a given
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * message should be used in authentication. Thus each message
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * must provide the correct components in the correct order.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * These components are passed via Object[]s. The Object[] elements
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * should be in externalized form, and should be ordered as stated
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * in the protocol specification for auth blocks. AuthBlocks will
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * add the externalized SPI string before the Object[] and the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * externalized timestamp after the vector.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * The AuthBlock class provides a number of static convenience
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * methods which operate on sets of AuthBlocks. The sets of
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * AuthBlocks are stored in Hashtables, keyed by SPIs.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static private String SPI_PROPERTY = "sun.net.slp.SPIs";
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * A convenience method for creating a set of auth blocks
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * from internal data structures.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param message The ordered components of the SLP message
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * over which the signature should be computed,
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * in externalized (byte[]) form.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param lifetime The lifetime for this message, in seconds.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @return A Hashtable of AuthBlocks, one for each SPI, null if no
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * SPIs have been configured.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception ServiceLocationException If a key management or crypto
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * algorithm provider cannot be
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * instantiated, a SYSTEM_ERROR exception
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IllegalArgumentException If any of the parameters are null
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static Hashtable makeAuthBlocks(Object[] message, int lifetime)
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra throws ServiceLocationException, IllegalArgumentException {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra ServiceLocationException.AUTHENTICATION_FAILED,
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra String spi = (String) spisEnum.nextElement();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra int bsd = ((Integer)(spis.get(spi))).intValue();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra blocks.put(spi, new AuthBlock(message, spi, bsd, lifetime));
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * A convenience method which creates a Hashtable of auth blocks
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * from an input stream.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param hdr Header of message being parsed out.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param message The ordered components of the SLP message
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * over which the signature should have been computed,
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * in externalized (byte[]) form.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param dis Input stream with the auth block bytes queued up as the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * next thing.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param nBlocks Number of auth blocks to read.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @return A Hashtable of AuthBlocks.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception ServiceLocationException If anything goes wrong during
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * parsing. If nBlocks is 0, the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * error code is AUTHENTICATION_ABSENT.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IllegalArgumentException If any of the parameters are null
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IOException If DataInputStream throws it.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static Hashtable makeAuthBlocks(SrvLocHeader hdr,
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra AuthBlock ab = new AuthBlock(hdr, message, dis);
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * A convenience method which verifies all auth blocks in the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * input Hashtable.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param authBlocks A Hashtable containing AuthBlocks.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception ServiceLocationException Thrown if authentication fails,
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * with the error code
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * ServiceLocationException.AUTHENTICATION_FAILED. If any
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * other error occurs during authentication, the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * error code is ServiceLocationException.SYSTEM_ERROR.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * If the signature hasn't been calculated the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * authentication fails.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IllegalArgumentException If authBlocks is null or empty.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra throws ServiceLocationException, IllegalArgumentException {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra AuthBlock ab = (AuthBlock) blocks.nextElement();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * A convenience method which finds the shortest lifetime in a
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * set of AuthBlocks.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param authBlocks A Hashtable containing AuthBlocks.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @return The shortest lifetime found.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IllegalArgumentException If authBlocks is null or empty.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static int getShortestLifetime(Hashtable authBlocks)
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra AuthBlock ab = (AuthBlock) blocks.nextElement();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra lifetime = (lifetime < abLife) ? lifetime : abLife;
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * A convenience method which externalizes a set of AuthBlocks
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * into a ByteArrayOutputStream. The number of blocks is NOT
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * written onto the stream.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param hdr Header of message being externalized.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param authBlocks A Hashtable containing AuthBlocks.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param baos The output stream into which to write.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception ServiceLocationException Thrown if an error occurs during
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * output, with PARSE_ERROR error code.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IllegalArgumentException If any parameters are null, or
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * if authBlocks is empty.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra throws ServiceLocationException, IllegalArgumentException {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra AuthBlock ab = (AuthBlock) blocks.nextElement();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Returns the message parts obtained from the AuthBlock contructor.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * The Object[] will not have been altered. Note that all AuthBlocks
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * contain the same message Object[] Object.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param authBlocks A Hashtable containing AuthBlocks.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @return This auth block's message components Object[].
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IllegalArgumentException If authBlocks is null or empty.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static Object[] getContents(Hashtable authBlocks)
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra AuthBlock ab = (AuthBlock) blocks.nextElement();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Creates a String describing all auth blocks in authBlocks.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * We dont't use toString() since that would get Hashtable.toString(),
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * and we can format it a little prettier.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param authBlocks A Hashtable containing AuthBlocks.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @return A String description of all AuthBlocks in this Hashtable
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra return "null";
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra String desc = size == 1 ? "1 Auth Block:\n" : size + " Auth Blocks:\n";
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra AuthBlock ab = (AuthBlock) blocks.nextElement();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra desc = desc + " " + (cnt++) + ": " + ab.toString();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Returns the list of SPIs configured with this 'prop', or null
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * if the property hasn't been set.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra return commaSeparatedListToLinkedList(spiProp);
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Converts a comma-separaterd list in a String to a LinkedList.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static LinkedList commaSeparatedListToLinkedList(String listStr) {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra StringTokenizer stk_comma = new StringTokenizer(listStr, ",");
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Returns true if this principal is someDH, or if this principal's
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * cert has been signed by someDN.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static boolean canSignAs(String someDN) throws ServiceLocationException {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra return false;
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra return false;
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra myCert.getSubjectDN().toString(), cert.getSubjectDN());
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Checks if caDN is in ab's equivalency set, i.e. if caDN
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * is in ab's cert chain.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static boolean checkEquiv(String caDN, AuthBlock ab) {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra // Get cert for input DN
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra "cant_get_equivalency",
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra return false;
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Filters out from auths all auth blocks which have not been
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * signed by DNs equivalent to caDN.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static AuthBlock getEquivalentAuth(String caDN, Hashtable authBlocks) {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra // Get cert for input DN
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra "cant_get_equivalency",
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra AuthBlock ab = (AuthBlock) blocks.nextElement();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Gets a list of signing identities. Returns a Hashtable of
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * which the keys are SPI strings (DNs) and the values
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * are BSD Integers.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static Hashtable getSignAs() throws ServiceLocationException {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra /* derive DN from alias */
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra e_DN = ServiceLocationAttribute.escapeAttributeString(DN, false);
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra // Shouldn't get here if badTag == false
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra String alg = cert.getPublicKey().getAlgorithm();
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra SLPConfig.getSLPConfig().writeLog("bad_alg_for_alias",
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Returns the cert corresponding to our signing alias.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @@@ change this when AMI goes in to use private AMI interface.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra static X509Certificate getSignAsCert() throws ServiceLocationException {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra String spiProp = System.getProperty("sun.net.slp.signAs");
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra /* load key store */
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra StringTokenizer stk_comma = new StringTokenizer(spiProp, ",");
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra // Can only sign with one alias, so ignore any extras
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra /* get keypkg for this alias */
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Creates a new AuthBlock based on the SPI and message parts.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param message The ordered components of the SLP message
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * over which the signature should be computed,
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * in externalized (byte[]) form.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param spi The SLP SPI for which to create the auth block.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param lifetime The lifetime for this message, in seconds.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception ServiceLocationException If a key management or crypto
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * algorithm provider cannot be
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * instantiated, a SYSTEM_ERROR exception
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IllegalArgumentException If any of the parameters are null
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra AuthBlock(Object[] message, String spi, int bsd, int lifetime)
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra throws ServiceLocationException, IllegalArgumentException {
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra // init crypto provider associated with bsd
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra this.timeStamp = SLPConfig.currentSLPTime() + lifetime;
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra // Create the signature: create and sign the hash
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra // @@@ how to sign for different aliases?
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra } catch (InvalidKeyException e) { // @@@ will change for AMI
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra "cant_sign_for_spi",
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra "cant_sign_for_spi",
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra // calculate the length
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra spiBytes.length + // externalized SPI string, with length
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * Creates a new AuthBlock from an input stream.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param hdr The header of the message being parsed.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param message The ordered components of the SLP message
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * over which the signature should have been computed,
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * in externalized (byte[]) form.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @param dis Input stream with the auth block bytes queued up as the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * next thing.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception ServiceLocationException If anything goes wrong during
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * parsing. If nBlocks is 0, the
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * error code is AUTHENTICATION_ABSENT.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IllegalArgumentException If any of the parameters are null
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra * @exception IOException If DataInputStream throws it.
dbed73cbda2229fd1aa6dc5743993cae7f0a7ee9Sangeeta Misra AuthBlock(SrvLocHeader hdr, Object[] message, DataInputStream dis)
throw new ServiceLocationException(
return abLength;
return message;
} catch (Exception e) {
u_DN =
} catch (ServiceLocationException e) {
} catch (CertificateException e) {
throw new ServiceLocationException(
throw new ServiceLocationException(
} catch (GeneralSecurityException e) {
throw new ServiceLocationException(
new Object[] {
u_DN,
computeHash();
throw vex;
throw vex;
return spi;
return lifetime;
throws ServiceLocationException {
} catch (GeneralSecurityException e) {
throw new ServiceLocationException(
new Object[] {
algo,
e.getMessage()});
throw new ServiceLocationException(
new Object[] {
algo,
throws IllegalArgumentException {
if (v != null) {
if (v instanceof Object[]) {
} catch (SignatureException e) {
throw new ServiceLocationException(
throw new ServiceLocationException(
throw new ServiceLocationException(
} catch (ClassCastException e) {
throw new ServiceLocationException(
throw new ServiceLocationException(
} catch (NoSuchElementException e) {
} catch (ServiceLocationException e) {
throws ServiceLocationException {
} catch (KeyStoreException e) {
throw ex;
throw ex;
throws ServiceLocationException {
} catch (ServiceLocationException e) {
throw new ServiceLocationException(
} catch (ClassCastException e) {
throw new ServiceLocationException(
} catch (KeyStoreException e) {
throw new ServiceLocationException(
throw new ServiceLocationException(
return cert;
throws ServiceLocationException {
return keypkg;
} catch (Exception e) {
throw new ServiceLocationException(
return keypkg;
throws ServiceLocationException {
return keystore;
} catch (Exception e) {
return keystore;