All Downloads are FREE. Search and download functionalities are using the official Maven repository.

be.atbash.ee.security.octopus.nimbus.jwk.JWKIdentifiers Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2017-2022 Rudy De Busscher (https://www.atbash.be)
 *
 * 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 be.atbash.ee.security.octopus.nimbus.jwk;

import be.atbash.ee.security.octopus.nimbus.jose.HeaderParameterNames;
import be.atbash.util.PublicAPI;

/**
 * JSON Web Key (JWK) parameter names. The JWK parameter names defined in
 * RFC 7517 (JWK),
 * RFC 7518 (JWA)
 * and other JOSE related standards are tracked in a
 * JWK
 * parameters registry administered by IANA.
 *
 * @author Nathaniel Hart
 * @version 2021-07-02
 */
@PublicAPI
public final class JWKIdentifiers {

    private JWKIdentifiers() {
    }

    ////////////////////////////////////////////////////////////////////////////////
    // RFC 7517 JSON Web Key (JWK) Parameters
    ////////////////////////////////////////////////////////////////////////////////


    /**
     * @see RFC 7517 "kty" (Key Type) Parameter
     */
    public static final String KEY_TYPE = "kty";


    /**
     * @see RFC 7517 "use" (Public Key Use) Parameter
     */
    public static final String PUBLIC_KEY_USE = "use";


    /**
     * Use with {@link KeyType#OKP}
     *
     * @see RFC 7517 "enc" (encryption) Parameter Value
     */
    public static final String ENCRYPTION_ALGORITHM = HeaderParameterNames.ENCRYPTION_ALGORITHM;


    /**
     * Use with {@link KeyType#OKP}
     *
     * @see RFC 7517 "sig" (signature) Parameter Value
     */
    public static final String SIGNATURE = "sig";


    /**
     * @see RFC 7517 "key_ops" (Key Operations) Parameter
     */
    public static final String KEY_OPS = "key_ops";


    /**
     * @see RFC 7517 "alg" (Algorithm) Parameter
     */
    public static final String ALGORITHM = HeaderParameterNames.ALGORITHM;


    /**
     * @see RFC 7517 "kid" (Key ID) Parameter
     */
    public static final String KEY_ID = HeaderParameterNames.KEY_ID;


    /**
     * @see RFC 7517 "x5u" (X.509 URL) Parameter
     */
    public static final String X_509_URL = HeaderParameterNames.X_509_URL;


    /**
     * @see RFC 7517 "x5c" (X.509 Certificate Chain) Parameter
     */
    public static final String X_509_CERT_CHAIN = HeaderParameterNames.X_509_CERT_CHAIN;


    /**
     * @see RFC 7517 "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter
     */
    public static final String X_509_CERT_SHA_1_THUMBPRINT = HeaderParameterNames.X_509_CERT_SHA_1_THUMBPRINT;


    /**
     * @see RFC 7517 "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header
     * Parameter
     */
    public static final String X_509_CERT_SHA_256_THUMBPRINT = HeaderParameterNames.X_509_CERT_SHA_256_THUMBPRINT;


    /**
     * @see RFC 7517 "keys" Parameter
     */
    public static final String KEYS = "keys";


    /**
     * The Key Type Parameter for {@link KeyType#EC}
     *
     * @see "kty" (Key Type) Parameter Values
     */
    public static final String ELLIPTIC_CURVE_KEY_TYPE = "EC";


    /**
     * The Key Type Parameter for {@link KeyType#RSA}
     *
     * @see "kty" (Key Type) Parameter Values
     */
    public static final String RSA_KEY_TYPE = "RSA";


    /**
     * The Key Type Parameter for {@link KeyType#OCT}
     *
     * @see "kty" (Key Type) Parameter Values
     */
    public static final String OCTET_SEQUENCE_KEY_TYPE = "oct";


    ////////////////////////////////////////////////////////////////////////////////
    // RFC 7518 JSON Web Algorithms (JWA) Parameters
    ////////////////////////////////////////////////////////////////////////////////


    /**
     * Use with {@link KeyType#EC}.
     *
     * @see RFC 7518 "crv" (Curve) Parameter
     */
    public static final String CURVE = "crv";


    /**
     * Use with {@link KeyType#EC}.
     *
     * @see RFC 7518 "x" (X Coordinate) Parameter
     */
    public static final String X_COORD = "x";


    /**
     * Use with {@link KeyType#EC}.
     *
     * @see RFC 7518 "y" (Y Coordinate) Parameter
     */
    public static final String Y_COORD = "y";


    /**
     * An identifier shared by {@link #ECC_PRIVATE_KEY}, {@link #PRIVATE_EXPONENT}, and {@link #FACTOR_CRT_EXPONENT}
     *
     * @see RFC 7518 "d" (ECC Private Key) Parameter
     * @see RFC 7518 "d" (Private Exponent) Parameter
     * @see RFC 7518 "d" (Factor CRT Exponent)
     */
    public static final String D = "d";


    /**
     * Use with {@link KeyType#EC}.
     *
     * @see RFC 7518 "d" (ECC Private Key) Parameter
     */
    public static final String ECC_PRIVATE_KEY = D;


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "n" (Modulus) Parameter
     */
    public static final String MODULUS = "n";


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "e" (Exponent) Parameter
     */
    public static final String EXPONENT = "e";


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "d" (Private Exponent) Parameter
     */
    public static final String PRIVATE_EXPONENT = D;


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "p" (First Prime Factor) Parameter
     */
    public static final String FIRST_PRIME_FACTOR = "p";


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "q" (Second Prime Factor) Parameter
     */
    public static final String SECOND_PRIME_FACTOR = "q";


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "dp" (First Factor CRT Exponent) Parameter
     */
    public static final String FIRST_FACTOR_CRT_EXPONENT = "dp";


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "dq" (Second Factor CRT Exponent) Parameter
     */
    public static final String SECOND_FACTOR_CRT_EXPONENT = "dq";


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "qi" (First CRT Coefficient) Parameter
     */
    public static final String FIRST_CRT_COEFFICIENT = "qi";


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "oth" (Other Primes Info) Parameter
     */
    public static final String OTHER_PRIMES = "oth";


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "r" (Prime Factor)
     */
    public static final String PRIME_FACTOR = "r";


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "d" (Factor CRT Exponent)
     */
    public static final String FACTOR_CRT_EXPONENT = D;


    /**
     * Use with {@link KeyType#RSA}.
     *
     * @see RFC 7518 "t" (Factor CRT Coefficient)
     */
    public static final String FACTOR_CRT_COEFFICIENT = "t";


    /**
     * Use with {@link KeyType#OCT}
     *
     * @see RFC 7518 "k" (Key Value) Parameter
     */
    public static final String OCT_KEY_VALUE = "k";


    ////////////////////////////////////////////////////////////////////////////////
    // RFC 8037 CFRG Elliptic Curve Diffie-Hellman (ECDH) and Signatures in JOSE
    ////////////////////////////////////////////////////////////////////////////////


    /**
     * The Key Type Parameter for {@link KeyType#OKP}
     *
     * @see RFC 8037 "OKP" (Octet Key Pair)
     */
    public static final String OCTET_KEY_PAIR = "OKP";
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy