-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Define JWT MAC V0 config and key gen config.
PiperOrigin-RevId: 707982364 Change-Id: I4dacfe00a06cde3053952468a116ab08ff05f5c4
- Loading branch information
1 parent
c988c03
commit fffa2bc
Showing
14 changed files
with
674 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// 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. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
#include "tink/jwt/internal/jwt_mac_config_v0.h" | ||
|
||
#include "absl/memory/memory.h" | ||
#include "tink/configuration.h" | ||
#include "tink/internal/configuration_impl.h" | ||
#include "tink/jwt/internal/jwt_hmac_key_manager.h" | ||
#include "tink/jwt/internal/jwt_mac_wrapper.h" | ||
#include "tink/util/status.h" | ||
|
||
namespace crypto { | ||
namespace tink { | ||
namespace jwt_internal { | ||
|
||
util::Status AddJwtMacV0(Configuration& config) { | ||
util::Status status = internal::ConfigurationImpl::AddPrimitiveWrapper( | ||
absl::make_unique<JwtMacWrapper>(), config); | ||
if (!status.ok()) { | ||
return status; | ||
} | ||
return internal::ConfigurationImpl::AddKeyTypeManager( | ||
absl::make_unique<JwtHmacKeyManager>(), config); | ||
} | ||
|
||
} // namespace jwt_internal | ||
} // namespace tink | ||
} // namespace crypto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2024 Google LLC | ||
// | ||
// 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. | ||
// | ||
//////////////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef TINK_JWT_INTERNAL_JWT_MAC_CONFIG_V0_H_ | ||
#define TINK_JWT_INTERNAL_JWT_MAC_CONFIG_V0_H_ | ||
|
||
#include "tink/configuration.h" | ||
#include "tink/util/status.h" | ||
|
||
namespace crypto { | ||
namespace tink { | ||
namespace jwt_internal { | ||
|
||
// Add recommended JWT MAC primitive wrappers and key managers to `config`, used | ||
// to generate primitives. | ||
util::Status AddJwtMacV0(Configuration& config); | ||
|
||
} // namespace jwt_internal | ||
} // namespace tink | ||
} // namespace crypto | ||
|
||
#endif // TINK_JWT_INTERNAL_JWT_MAC_CONFIG_V0_H_ |
Oops, something went wrong.