xref: /aosp_15_r20/external/tink/cc/jwt/jwt_key_templates.h (revision e7b1675dde1b92d52ec075b0a92829627f2c52a5)
1 // Copyright 2021 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 
17 #ifndef TINK_JWT_JWT_KEY_TEMPLATES_H_
18 #define TINK_JWT_JWT_KEY_TEMPLATES_H_
19 
20 #include "proto/tink.pb.h"
21 
22 namespace crypto {
23 namespace tink {
24 
25 ///////////////////////////////////////////////////////////////////////////////
26 // Pre-generated KeyTemplate for Jwt key types. One can use these templates
27 // to generate new KeysetHandle object with fresh keys. The templates with
28 // the "Raw" prefix generate tokens without a "kid" header.
29 //
30 // To generate a new keyset that contains a single JwtHmacKey, one can do:
31 //
32 //   auto status = JwtMacRegister();
33 //   if (!status.ok()) { /* fail with error */ }
34 //   auto handle_result =
35 //       KeysetHandle::GenerateNew(JwtHs256Template());
36 //   if (!handle_result.ok()) { /* fail with error */ }
37 //   auto keyset_handle = std::move(handle_result.value());
38 const google::crypto::tink::KeyTemplate& JwtHs256Template();
39 const google::crypto::tink::KeyTemplate& RawJwtHs256Template();
40 const google::crypto::tink::KeyTemplate& JwtHs384Template();
41 const google::crypto::tink::KeyTemplate& RawJwtHs384Template();
42 const google::crypto::tink::KeyTemplate& JwtHs512Template();
43 const google::crypto::tink::KeyTemplate& RawJwtHs512Template();
44 
45 const google::crypto::tink::KeyTemplate& JwtEs256Template();
46 const google::crypto::tink::KeyTemplate& RawJwtEs256Template();
47 const google::crypto::tink::KeyTemplate& JwtEs384Template();
48 const google::crypto::tink::KeyTemplate& RawJwtEs384Template();
49 const google::crypto::tink::KeyTemplate& JwtEs512Template();
50 const google::crypto::tink::KeyTemplate& RawJwtEs512Template();
51 
52 const google::crypto::tink::KeyTemplate& JwtRs256_2048_F4_Template();
53 const google::crypto::tink::KeyTemplate& RawJwtRs256_2048_F4_Template();
54 const google::crypto::tink::KeyTemplate& JwtRs256_3072_F4_Template();
55 const google::crypto::tink::KeyTemplate& RawJwtRs256_3072_F4_Template();
56 const google::crypto::tink::KeyTemplate& JwtRs384_3072_F4_Template();
57 const google::crypto::tink::KeyTemplate& RawJwtRs384_3072_F4_Template();
58 const google::crypto::tink::KeyTemplate& JwtRs512_4096_F4_Template();
59 const google::crypto::tink::KeyTemplate& RawJwtRs512_4096_F4_Template();
60 
61 const google::crypto::tink::KeyTemplate& JwtPs256_2048_F4_Template();
62 const google::crypto::tink::KeyTemplate& RawJwtPs256_2048_F4_Template();
63 const google::crypto::tink::KeyTemplate& JwtPs256_3072_F4_Template();
64 const google::crypto::tink::KeyTemplate& RawJwtPs256_3072_F4_Template();
65 const google::crypto::tink::KeyTemplate& JwtPs384_3072_F4_Template();
66 const google::crypto::tink::KeyTemplate& RawJwtPs384_3072_F4_Template();
67 const google::crypto::tink::KeyTemplate& JwtPs512_4096_F4_Template();
68 const google::crypto::tink::KeyTemplate& RawJwtPs512_4096_F4_Template();
69 
70 }  // namespace tink
71 }  // namespace crypto
72 
73 #endif  // TINK_JWT_JWT_KEY_TEMPLATES_H_
74