// Copyright 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////

package com.google.crypto.tink.mac;

import com.google.crypto.tink.Registry;
import com.google.crypto.tink.proto.RegistryConfig;
import java.security.GeneralSecurityException;

Static methods and constants for registering with the Registry all instances of Mac key types supported in a particular release of Tink.

To register all Mac key types provided in the latest Tink version one can do:


MacConfig.register();

For more information on how to obtain and use instances of Mac, see MacFactory.

Since:1.0.0
/** * Static methods and constants for registering with the {@link Registry} all instances of {@link * com.google.crypto.tink.Mac} key types supported in a particular release of Tink. * * <p>To register all Mac key types provided in the latest Tink version one can do: * * <pre>{@code * MacConfig.register(); * }</pre> * * <p>For more information on how to obtain and use instances of Mac, see {@link MacFactory}. * * @since 1.0.0 */
public final class MacConfig { public static final String HMAC_TYPE_URL = new HmacKeyManager().getKeyType();
Deprecated:
/** @deprecated */
@Deprecated public static final RegistryConfig TINK_1_0_0 = RegistryConfig.getDefaultInstance();
Deprecated:
Since:1.1.0
/** * @deprecated * @since 1.1.0 */
@Deprecated public static final RegistryConfig TINK_1_1_0 = TINK_1_0_0;
Deprecated:
Since:1.2.0
/** * @deprecated * @since 1.2.0 */
@Deprecated public static final RegistryConfig LATEST = TINK_1_0_0; static { try { init(); } catch (GeneralSecurityException e) { throw new ExceptionInInitializerError(e); } }
Tries to register with the Registry all instances of Catalogue and KeyManager needed to handle Mac key types supported in Tink.
Deprecated:use register
/** * Tries to register with the {@link Registry} all instances of {@link * com.google.crypto.tink.Catalogue} and {@link com.google.crypto.tink.KeyManager} needed to * handle Mac key types supported in Tink. * * @deprecated use {@link #register} */
@Deprecated public static void init() throws GeneralSecurityException { register(); }
Tries to register with the Registry all instances of Catalogue and KeyManager needed to handle Mac key types supported in Tink.
Since:1.2.0
/** * Tries to register with the {@link Registry} all instances of {@link * com.google.crypto.tink.Catalogue} and {@link com.google.crypto.tink.KeyManager} needed to * handle Mac key types supported in Tink. * * @since 1.2.0 */
public static void register() throws GeneralSecurityException { HmacKeyManager.register(true); AesCmacKeyManager.register(true); MacWrapper.register(); }
Registers with the Registry all Mac key types released with the latest version of Tink.

Deprecated-yet-still-supported key types are registered in so-called "no new key"-mode, which allows for usage of existing keys forbids generation of new key material.

Deprecated:use register
/** * Registers with the {@code Registry} all Mac key types released with the latest version of Tink. * * <p>Deprecated-yet-still-supported key types are registered in so-called "no new key"-mode, * which allows for usage of existing keys forbids generation of new key material. * * @deprecated use {@link #register} */
@Deprecated public static void registerStandardKeyTypes() throws GeneralSecurityException { register(); } }