1 // Copyright 2020 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 // 15 //////////////////////////////////////////////////////////////////////////////// 16 package com.google.crypto.tink.tinkkey; 17 18 import com.google.errorprone.annotations.Immutable; 19 20 /** 21 * A class used to generate {@code KeyAccess} instances granting secret access. 22 * 23 * <p>This class can be used to keep track of places where secret keys are accessed directly in 24 * code, as opposed to indirectly via a primitive. 25 * 26 * <p>Do not use this in new code. Instead, use {@link 27 * com.google.crypto.tink.InsecureSecretKeyAccess} instead. 28 */ 29 @Immutable 30 public final class SecretKeyAccess { 31 SecretKeyAccess()32 private SecretKeyAccess() {} 33 34 /** 35 * Returns a {@code KeyAccess} instance where {@code canAccessSecret()} returns true. 36 **/ insecureSecretAccess()37 public static KeyAccess insecureSecretAccess() { 38 return KeyAccess.secretAccess(); 39 } 40 } 41