jdk/src/java.base/share/classes/java/security/DomainLoadStoreParameter.java
author coleenp
Wed, 30 Aug 2017 19:18:22 -0400
changeset 47098 e704f55561c3
parent 25859 3317bb8137f4
permissions -rw-r--r--
8164207: Checking missing load-acquire in relation to _pd_set in dictionary.cpp Summary: Use load_acquire for accessing DictionaryEntry::_pd_set since it's accessed outside the SystemDictionary_lock Reviewed-by: zgu, twisti, dholmes, adinn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20743
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
     1
/*
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
     4
 *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    10
 *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    15
 * accompanied this code).
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    16
 *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    20
 *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    23
 * questions.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    24
 */
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    25
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    26
package java.security;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    27
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    28
import java.net.URI;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    29
import java.util.*;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    30
import static java.security.KeyStore.*;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    31
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    32
/**
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    33
 * Configuration data that specifies the keystores in a keystore domain.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    34
 * A keystore domain is a collection of keystores that are presented as a
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    35
 * single logical keystore. The configuration data is used during
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    36
 * {@code KeyStore}
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    37
 * {@link KeyStore#load(KeyStore.LoadStoreParameter) load} and
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    38
 * {@link KeyStore#store(KeyStore.LoadStoreParameter) store} operations.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    39
 * <p>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    40
 * The following syntax is supported for configuration data:
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    41
 * <pre>{@code
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    42
 *     domain <domainName> [<property> ...] {
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    43
 *         keystore <keystoreName> [<property> ...] ;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    44
 *         ...
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    45
 *     };
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    46
 *     ...
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    47
 * }</pre>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    48
 * where {@code domainName} and {@code keystoreName} are identifiers
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    49
 * and {@code property} is a key/value pairing. The key and value are
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    50
 * separated by an 'equals' symbol and the value is enclosed in double
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    51
 * quotes. A property value may be either a printable string or a binary
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    52
 * string of colon-separated pairs of hexadecimal digits. Multi-valued
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    53
 * properties are represented as a comma-separated list of values,
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    54
 * enclosed in square brackets.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    55
 * See {@link Arrays#toString(java.lang.Object[])}.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    56
 * <p>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    57
 * To ensure that keystore entries are uniquely identified, each
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    58
 * entry's alias is prefixed by its {@code keystoreName} followed
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    59
 * by the entry name separator and each {@code keystoreName} must be
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    60
 * unique within its domain. Entry name prefixes are omitted when
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    61
 * storing a keystore.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    62
 * <p>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    63
 * Properties are context-sensitive: properties that apply to
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    64
 * all the keystores in a domain are located in the domain clause,
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    65
 * and properties that apply only to a specific keystore are located
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    66
 * in that keystore's clause.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    67
 * Unless otherwise specified, a property in a keystore clause overrides
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    68
 * a property of the same name in the domain clause. All property names
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    69
 * are case-insensitive. The following properties are supported:
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    70
 * <dl>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    71
 * <dt> {@code keystoreType="<type>"} </dt>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    72
 *     <dd> The keystore type. </dd>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    73
 * <dt> {@code keystoreURI="<url>"} </dt>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    74
 *     <dd> The keystore location. </dd>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    75
 * <dt> {@code keystoreProviderName="<name>"} </dt>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    76
 *     <dd> The name of the keystore's JCE provider. </dd>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    77
 * <dt> {@code keystorePasswordEnv="<environment-variable>"} </dt>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    78
 *     <dd> The environment variable that stores a keystore password.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    79
 *          Alternatively, passwords may be supplied to the constructor
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    80
 *          method in a {@code Map<String, ProtectionParameter>}. </dd>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    81
 * <dt> {@code entryNameSeparator="<separator>"} </dt>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    82
 *     <dd> The separator between a keystore name prefix and an entry name.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    83
 *          When specified, it applies to all the entries in a domain.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    84
 *          Its default value is a space. </dd>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    85
 * </dl>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    86
 * <p>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    87
 * For example, configuration data for a simple keystore domain
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    88
 * comprising three keystores is shown below:
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    89
 * <pre>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    90
 *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    91
 * domain app1 {
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    92
 *     keystore app1-truststore
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    93
 *         keystoreURI="file:///app1/etc/truststore.jks";
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    94
 *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    95
 *     keystore system-truststore
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    96
 *         keystoreURI="${java.home}/lib/security/cacerts";
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    97
 *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    98
 *     keystore app1-keystore
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
    99
 *         keystoreType="PKCS12"
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   100
 *         keystoreURI="file:///app1/etc/keystore.p12";
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   101
 * };
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   102
 *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   103
 * </pre>
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   104
 * @since 1.8
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   105
 */
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   106
public final class DomainLoadStoreParameter implements LoadStoreParameter {
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   107
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   108
    private final URI configuration;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   109
    private final Map<String,ProtectionParameter> protectionParams;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   110
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   111
    /**
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   112
     * Constructs a DomainLoadStoreParameter for a keystore domain with
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   113
     * the parameters used to protect keystore data.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   114
     *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   115
     * @param configuration identifier for the domain configuration data.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   116
     *     The name of the target domain should be specified in the
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   117
     *     {@code java.net.URI} fragment component when it is necessary
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   118
     *     to distinguish between several domain configurations at the
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   119
     *     same location.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   120
     *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   121
     * @param protectionParams the map from keystore name to the parameter
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   122
     *     used to protect keystore data.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   123
     *     A {@code java.util.Collections.EMPTY_MAP} should be used
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   124
     *     when protection parameters are not required or when they have
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   125
     *     been specified by properties in the domain configuration data.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   126
     *     It is cloned to prevent subsequent modification.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   127
     *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   128
     * @exception NullPointerException if {@code configuration} or
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   129
     *     {@code protectionParams} is {@code null}
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   130
     */
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   131
    public DomainLoadStoreParameter(URI configuration,
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   132
        Map<String,ProtectionParameter> protectionParams) {
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   133
        if (configuration == null || protectionParams == null) {
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   134
            throw new NullPointerException("invalid null input");
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   135
        }
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   136
        this.configuration = configuration;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   137
        this.protectionParams =
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   138
            Collections.unmodifiableMap(new HashMap<>(protectionParams));
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   139
    }
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   140
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   141
    /**
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   142
     * Gets the identifier for the domain configuration data.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   143
     *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   144
     * @return the identifier for the configuration data
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   145
     */
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   146
    public URI getConfiguration() {
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   147
        return configuration;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   148
    }
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   149
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   150
    /**
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   151
     * Gets the keystore protection parameters for keystores in this
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   152
     * domain.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   153
     *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   154
     * @return an unmodifiable map of keystore names to protection
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   155
     *     parameters
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   156
     */
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   157
    public Map<String,ProtectionParameter> getProtectionParams() {
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   158
        return protectionParams;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   159
    }
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   160
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   161
    /**
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   162
     * Gets the keystore protection parameters for this domain.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   163
     * Keystore domains do not support a protection parameter.
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   164
     *
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   165
     * @return always returns {@code null}
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   166
     */
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   167
    @Override
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   168
    public KeyStore.ProtectionParameter getProtectionParameter() {
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   169
        return null;
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   170
    }
cd866b3875d8 8008171: Refactor KeyStore.DomainLoadStoreParameter as a standalone class
vinnie
parents:
diff changeset
   171
}