1 /******************************************************************************* 2 * Copyright (c) 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 12 package org.eclipse.osgi.framework.adaptor.core; 13 14 import java.io.IOException; 15 16 /** 17 * The SignedBundle class is used to support bundle signing. Every SignedBundle wraps a 18 * BundleFile object. A SignedBundle uses the wrapped BundleFile to extract signitures 19 * and digents from and validates input streams for the wrapped BundleFile. 20 * <p> 21 * Clients may extend this class. 22 * </p> 23 * @since 3.1 24 */ 25 public abstract class SignedBundle extends BundleFile { 26 /** 27 * Sets the BundleFile for this singed bundle. It will extract 28 * signatures and digests from the bundle file and validate input streams 29 * before using them from the bundle file. 30 * 31 * @param bundleFile the BundleFile to extract elements from. 32 * @throws IOException 33 */ 34 public abstract void setBundleFile(BundleFile bundleFile) throws IOException; 35 36 /** 37 * Matches the distinguished name chains of a bundle's signers against a 38 * pattern of a distinguished name chain. 39 * 40 * @param pattern the pattern of distinguished name (DN) chains to match 41 * against the dnChain. Wildcards "*" can be used in three cases: 42 * <ol> 43 * <li>As a DN. In this case, the DN will consist of just the "*". 44 * It will match zero or more DNs. For example, "cn=me,c=US;*;cn=you" 45 * will match "cn=me,c=US";cn=you" and 46 * "cn=me,c=US;cn=her,c=CA;cn=you". 47 * <li>As a DN prefix. In this case, the DN must start with "*,". 48 * The wild card will match zero or more RDNs at the start of a DN. 49 * For example, "*,cn=me,c=US;cn=you" will match "cn=me,c=US";cn=you" 50 * and "ou=my org unit,o=my org,cn=me,c=US;cn=you"</li> 51 * <li>As a value. In this case the value of a name value pair in an 52 * RDN will be a "*". The wildcard will match any value for the given 53 * name. For example, "cn=*,c=US;cn=you" will match 54 * "cn=me,c=US";cn=you" and "cn=her,c=US;cn=you", but it will not 55 * match "ou=my org unit,c=US;cn=you". If the wildcard does not occur 56 * by itself in the value, it will not be used as a wildcard. In 57 * other words, "cn=m*,c=US;cn=you" represents the common name of 58 * "m*" not any common name starting with "m".</li> 59 * </ol> 60 * @return true if a dnChain matches the pattern. A value of false is returned 61 * if bundle signing is not supported. 62 * @throws IllegalArgumentException 63 */ 64 public abstract boolean matchDNChain(String pattern); 65 } 66