/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* TemplateManager class.
*
* Not all PKCS#11 tokens are created equal. One token may require that one
* value is specified when creating a certain type of object. Another token
* may require a different value. Yet another token may only work if the
* attribute is not specified at all.
*
* In order to allow an application to work unmodified with all those
* different tokens, the SunPKCS11 provider makes the attributes that are
* specified and their value configurable. Hence, only the SunPKCS11
* configuration file has to be tweaked at deployment time to allow all
* existing applications to be used.
*
* The template manager is responsible for reading the attribute configuration
* information and to make it available to the various internal components
* of the SunPKCS11 provider.
*
* @author Andreas Sterbenz
* @since 1.5
*/
final class TemplateManager {
private final static boolean DEBUG = false;
// constant for any operation (either O_IMPORT or O_GENERATE)
// constant for operation create ("importing" existing key material)
// constant for operation generate (generating new key material)
private static class KeyAndTemplate {
}
}
// primitive templates contains the individual template configuration
// entries from the configuration file
// composite templates is a cache of the exact configuration template for
// each specific TemplateKey (no wildcards). the entries are created
// on demand during first use by compositing all applicable
// primitive template entries. the result is then stored in this map
// for performance
TemplateManager() {
}
// add a template. Called by Config.
CK_ATTRIBUTE[] attrs) {
if (DEBUG) {
}
}
}
return template;
}
// Get the attributes for the requested op and combine them with attrs.
// This is the method called by the implementation to obtain the
// attributes.
CK_ATTRIBUTE[] attrs) {
if (DEBUG) {
}
return newAttrs;
}
// build a composite template for the given key
// iterate through primitive templates and add all that apply
}
}
return comp;
}
/**
* Nested class representing a template identifier.
*/
private static final class TemplateKey {
final long keyType;
final long keyAlgorithm;
this.keyAlgorithm = keyAlgorithm;
}
if (this == obj) {
return true;
}
if (obj instanceof TemplateKey == false) {
return false;
}
return match;
}
public int hashCode() {
}
if ((keyAlgorithm == PCKK_ANY)
return true;
}
}
}
return false;
}
}
}
/**
* Nested class representing template attributes.
*/
private static final class Template {
Template() {
attributes = A0;
}
this.attributes = attributes;
}
}
}
/**
* Combine two sets of attributes. The second set has precedence
* over the first and overrides its settings.
*/
CK_ATTRIBUTE[] attrs2) {
}
}
}
}
}
}
}
}
}
}