001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2016 ForgeRock AS. 015 */ 016package org.forgerock.util.crypto; 017 018/** 019 * Constants for Crypto Algorithms and Json Crypto Json pointer keys. 020 */ 021public final class CryptoConstants { 022 023 /** 024 * key for the crypto json object. 025 */ 026 public static final String CRYPTO = "$crypto"; 027 028 /** 029 * key for crypt type used to generate the crypt value. 030 */ 031 public static final String CRYPTO_TYPE = "type"; 032 033 /** 034 * key for the crypt value, holding the crypt meta-data. 035 */ 036 public static final String CRYPTO_VALUE = "value"; 037 038 /** 039 * Key for the crypto algorithm used to crypt the data. 040 */ 041 public static final String CRYPTO_ALGORITHM = "algorithm"; 042 043 /** 044 * key for the password data within crypto json. 045 */ 046 public static final String CRYPTO_DATA = "data"; 047 048 /** 049 * key for the name of the key-store alias used to crypt the data. 050 */ 051 public static final String CRYPTO_KEY = "key"; 052 053 /** 054 * key for the cipher used to crypt the data. 055 */ 056 public static final String CRYPTO_CIPHER = "cipher"; 057 058 /** 059 * A cipher value for the AES/CBC/PKCS5Padding algorithm. 060 */ 061 public static final String CIPHER_AES_CBC_PKCS5 = "AES/CBC/PKCS5Padding"; 062 063 /** 064 * key for the Initialization Vector (a.k.a. salt) used to crypt the data. 065 */ 066 public static final String CRYPTO_IV = "iv"; 067 068 /** 069 * A salted hash encryption storage type. 070 */ 071 public static final String STORAGE_TYPE_HASH = "salted-hash"; 072 073 /** 074 * The name of the message digest algorithm that should be used to generate MD5 hashes. 075 */ 076 public static final String ALGORITHM_MD5 = "MD5"; 077 078 /** 079 * The name of the message digest algorithm that should be used to generate SHA-1 hashes. 080 */ 081 public static final String ALGORITHM_SHA_1 = "SHA-1"; 082 083 /** 084 * The name of the message digest algorithm that should be used to generate 256-bit SHA-2 hashes. 085 */ 086 public static final String ALGORITHM_SHA_256 = "SHA-256"; 087 088 /** 089 * The name of the message digest algorithm that should be used to generate 384-bit SHA-2 hashes. 090 */ 091 public static final String ALGORITHM_SHA_384 = "SHA-384"; 092 093 /** 094 * The name of the message digest algorithm that should be used to generate 512-bit SHA-2 hashes. 095 */ 096 public static final String ALGORITHM_SHA_512 = "SHA-512"; 097 098 private CryptoConstants() { 099 throw new UnsupportedOperationException(); 100 } 101}