-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 9abdb38 Author: Sven <[email protected]> Date: Tue May 14 09:16:09 2024 +0200 Add EcDSA verifier (#1353) * add ecdsa verifier * add identity_ecdsa_verifier to workspace, add license headers * Update identity_ecdsa_verifier/Cargo.toml Co-authored-by: wulfraem <[email protected]> * Update identity_ecdsa_verifier/src/secp256k1.rs Co-authored-by: wulfraem <[email protected]> * Update identity_ecdsa_verifier/Cargo.toml Co-authored-by: wulfraem <[email protected]> * Update identity_ecdsa_verifier/src/secp256k1.rs Co-authored-by: wulfraem <[email protected]> * Update identity_ecdsa_verifier/src/secp256r1.rs Co-authored-by: wulfraem <[email protected]> * add feedback * add OpenSSL installation to windows runner in CI * update license headers and authors for ecdsa verifier * update license template to allow multiple contributors --------- Co-authored-by: Sebastian Wolfram <[email protected]> commit 149bfac Author: wulfraem <[email protected]> Date: Mon May 13 10:44:09 2024 +0200 Fix findings after clippy update (#1365) * fix clippy findings * fix formatting * refactor .clone_into calls into .to_string * fix previous edit * disable empty_docs for wasm binding for now * fix missing newline * disable self update from rust setup in ci for now * update self update skip to skip only for windows build commit 51aedd5 Author: Enrico Marconi <[email protected]> Date: Tue Apr 30 16:16:36 2024 +0200 Use STRONGHOLD_PWD_FILE env variable to pass stronghold's password (#1363) commit edec26c Author: Enrico Marconi <[email protected]> Date: Tue Apr 30 15:40:55 2024 +0200 Arbitrary data signing service (#1350) commit f59e75a Author: Eike Haß <[email protected]> Date: Tue Apr 30 15:34:40 2024 +0200 Fix dockerhub workflow (#1343) commit 993cfec Author: Enrico Marconi <[email protected]> Date: Fri Apr 26 13:39:29 2024 +0200 add inx-faucet profile (#1356)
- Loading branch information
Showing
34 changed files
with
702 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// Copyright {20\d{2}(-20\d{2})?} IOTA Stiftung | ||
// Copyright {20\d{2}(-20\d{2})?} IOTA Stiftung{(?:, .+)?} | ||
// SPDX-License-Identifier: Apache-2.0 |
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,23 @@ | ||
// Copyright 2020-2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
syntax = "proto3"; | ||
package utils; | ||
|
||
message DataSigningRequest { | ||
// Raw data that will be signed. | ||
bytes data = 1; | ||
// Signing key's ID. | ||
string key_id = 2; | ||
} | ||
|
||
message DataSigningResponse { | ||
// Raw data signature. | ||
bytes signature = 1; | ||
} | ||
|
||
// Service that handles signing operations on raw data. | ||
service Signing { | ||
rpc sign(DataSigningRequest) returns (DataSigningResponse); | ||
} | ||
|
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,67 @@ | ||
// Copyright 2020-2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use _utils::signing_server::Signing as SigningSvc; | ||
use _utils::signing_server::SigningServer; | ||
use _utils::DataSigningRequest; | ||
use _utils::DataSigningResponse; | ||
use identity_iota::storage::JwkStorage; | ||
use identity_iota::storage::KeyId; | ||
use identity_iota::storage::KeyStorageError; | ||
use identity_stronghold::StrongholdStorage; | ||
use tonic::Request; | ||
use tonic::Response; | ||
use tonic::Status; | ||
|
||
mod _utils { | ||
tonic::include_proto!("utils"); | ||
} | ||
|
||
#[derive(Debug, thiserror::Error)] | ||
#[error("Key storage error: {0}")] | ||
pub struct Error(#[from] KeyStorageError); | ||
|
||
impl From<Error> for Status { | ||
fn from(value: Error) -> Self { | ||
Status::internal(value.to_string()) | ||
} | ||
} | ||
|
||
pub struct SigningService { | ||
storage: StrongholdStorage, | ||
} | ||
|
||
impl SigningService { | ||
pub fn new(stronghold: &StrongholdStorage) -> Self { | ||
Self { | ||
storage: stronghold.clone(), | ||
} | ||
} | ||
} | ||
|
||
#[tonic::async_trait] | ||
impl SigningSvc for SigningService { | ||
#[tracing::instrument( | ||
name = "utils/sign", | ||
skip_all, | ||
fields(request = ?req.get_ref()) | ||
ret, | ||
err, | ||
)] | ||
async fn sign(&self, req: Request<DataSigningRequest>) -> Result<Response<DataSigningResponse>, Status> { | ||
let DataSigningRequest { data, key_id } = req.into_inner(); | ||
let key_id = KeyId::new(key_id); | ||
let public_key_jwk = self.storage.get_public_key(&key_id).await.map_err(Error)?; | ||
let signature = self | ||
.storage | ||
.sign(&key_id, &data, &public_key_jwk) | ||
.await | ||
.map_err(Error)?; | ||
|
||
Ok(Response::new(DataSigningResponse { signature })) | ||
} | ||
} | ||
|
||
pub fn service(stronghold: &StrongholdStorage) -> SigningServer<SigningService> { | ||
SigningServer::new(SigningService::new(stronghold)) | ||
} |
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 |
---|---|---|
|
@@ -10,3 +10,4 @@ mod helpers; | |
mod jwt; | ||
mod sd_jwt_validation; | ||
mod status_list_2021; | ||
mod utils; |
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,48 @@ | ||
// Copyright 2020-2024 IOTA Stiftung | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use _utils::signing_client::SigningClient; | ||
use _utils::DataSigningRequest; | ||
use identity_iota::verification::jws::JwsAlgorithm; | ||
use identity_storage::JwkStorage; | ||
use identity_storage::KeyType; | ||
use identity_stronghold::StrongholdStorage; | ||
|
||
use crate::helpers::make_stronghold; | ||
use crate::helpers::TestServer; | ||
|
||
mod _utils { | ||
tonic::include_proto!("utils"); | ||
} | ||
|
||
const SAMPLE_SIGNING_DATA: &'static [u8] = b"I'm just some random data to be signed :)"; | ||
|
||
#[tokio::test] | ||
async fn raw_data_signing_works() -> anyhow::Result<()> { | ||
let stronghold = StrongholdStorage::new(make_stronghold()); | ||
let server = TestServer::new_with_stronghold(stronghold.clone()).await; | ||
|
||
let key_id = stronghold | ||
.generate(KeyType::from_static_str("Ed25519"), JwsAlgorithm::EdDSA) | ||
.await? | ||
.key_id; | ||
|
||
let expected_signature = { | ||
let public_key_jwk = stronghold.get_public_key(&key_id).await?; | ||
stronghold.sign(&key_id, SAMPLE_SIGNING_DATA, &public_key_jwk).await? | ||
}; | ||
|
||
let mut grpc_client = SigningClient::connect(server.endpoint()).await?; | ||
let signature = grpc_client | ||
.sign(DataSigningRequest { | ||
data: SAMPLE_SIGNING_DATA.to_owned(), | ||
key_id: key_id.to_string(), | ||
}) | ||
.await? | ||
.into_inner() | ||
.signature; | ||
|
||
assert_eq!(signature, expected_signature); | ||
|
||
Ok(()) | ||
} |
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
Oops, something went wrong.