001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with this
004 * work for additional information regarding copyright ownership. The ASF
005 * licenses this file to you under the Apache License, Version 2.0 (the
006 * "License"); you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
013 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
014 * License for the specific language governing permissions and limitations under
015 * the License.
016 */
017package org.apache.hadoop.hbase.io.crypto;
018
019import java.security.Key;
020
021import org.apache.yetus.audience.InterfaceAudience;
022
023/**
024 * KeyProvider is a interface to abstract the different methods of retrieving
025 * key material from key storage such as Java key store.
026 *
027 */
028@InterfaceAudience.Public
029public interface KeyProvider {
030
031  public static final String PASSWORD = "password";
032  public static final String PASSWORDFILE = "passwordfile";
033
034  /**
035   * Initialize the key provider
036   * @param params
037   */
038  public void init(String params);
039
040  /**
041   * Retrieve the key for a given key aliase
042   * @param alias
043   * @return the keys corresponding to the supplied alias, or null if a key is
044   * not found
045   */
046  public Key getKey(String alias);
047
048  /**
049   * Retrieve keys for a given set of key aliases
050   * @param aliases an array of aliases
051   * @return an array of keys corresponding to the supplied aliases, an
052   * entry will be null if a key is not found
053   */
054  public Key[] getKeys(String[] aliases);
055
056}