@@ -26,18 +26,15 @@ use ic_config::crypto::CryptoConfig;
26
26
use ic_crypto_internal_csp:: api:: CspPublicKeyStore ;
27
27
use ic_crypto_internal_csp:: { CryptoServiceProvider , Csp } ;
28
28
use ic_crypto_internal_logmon:: metrics:: CryptoMetrics ;
29
- use ic_crypto_tls_interfaces:: TlsHandshake ;
30
29
use ic_crypto_utils_basic_sig:: conversions:: derive_node_id;
31
30
use ic_crypto_utils_time:: CurrentSystemTimeSource ;
32
- use ic_interfaces:: crypto:: { BasicSigner , KeyManager , ThresholdSigVerifierByPublicKey } ;
31
+ use ic_interfaces:: crypto:: KeyManager ;
33
32
use ic_interfaces:: time_source:: TimeSource ;
34
33
use ic_interfaces_registry:: RegistryClient ;
35
34
use ic_logger:: { new_logger, ReplicaLogger } ;
36
35
use ic_metrics:: MetricsRegistry ;
37
36
use ic_protobuf:: registry:: crypto:: v1:: { PublicKey as PublicKeyProto , X509PublicKeyCert } ;
38
- use ic_types:: consensus:: CatchUpContentProtobufBytes ;
39
37
use ic_types:: crypto:: { CryptoError , CryptoResult , KeyPurpose } ;
40
- use ic_types:: messages:: MessageId ;
41
38
use ic_types:: { NodeId , RegistryVersion } ;
42
39
use parking_lot:: { RwLock , RwLockReadGuard , RwLockWriteGuard } ;
43
40
use std:: fmt;
@@ -51,42 +48,6 @@ pub const THRESHOLD_SIG_DATA_STORE_CAPACITY: usize = ThresholdSigDataStoreImpl::
51
48
/// See the Rust documentation of `CryptoComponentImpl`.
52
49
pub type CryptoComponent = CryptoComponentImpl < Csp > ;
53
50
54
- /// A crypto component that offers limited functionality and can be used outside
55
- /// of the replica process.
56
- ///
57
- /// This is an intermediate solution before crypto runs in a separate process.
58
- ///
59
- /// This should be used whenever crypto is required on a node, but a
60
- /// full-fledged `CryptoComponent` is not available. Example use cases are in
61
- /// separate process such as ic-fe or the orchestrator.
62
- ///
63
- /// Do not instantiate a CryptoComponent outside of the replica process, since
64
- /// that may lead to problems with concurrent access to the secret key store.
65
- /// `CryptoComponentForNonReplicaProcess` guarantees that only methods are
66
- /// exposed that don't risk running into such concurrency issues, as they do not
67
- /// modify the secret key store.
68
- pub trait CryptoComponentForNonReplicaProcess :
69
- KeyManager
70
- + BasicSigner < MessageId >
71
- + ThresholdSigVerifierByPublicKey < CatchUpContentProtobufBytes >
72
- + TlsHandshake
73
- + Send
74
- + Sync // TODO(CRP-606): add API for authenticating registry queries.
75
- {
76
- }
77
-
78
- // Blanket implementation of `CryptoComponentForNonReplicaProcess` for all types
79
- // that fulfill the requirements.
80
- impl < T > CryptoComponentForNonReplicaProcess for T where
81
- T : KeyManager
82
- + BasicSigner < MessageId >
83
- + ThresholdSigVerifierByPublicKey < CatchUpContentProtobufBytes >
84
- + TlsHandshake
85
- + Send
86
- + Sync
87
- {
88
- }
89
-
90
51
/// Allows Internet Computer nodes to perform crypto operations such as
91
52
/// distributed key generation, signing, signature verification, and TLS
92
53
/// handshakes.
@@ -282,54 +243,6 @@ impl CryptoComponentImpl<Csp> {
282
243
}
283
244
}
284
245
285
- /// Creates a crypto component that offers limited functionality and can be
286
- /// used outside of the replica process.
287
- ///
288
- /// Please refer to the trait documentation of
289
- /// `CryptoComponentForNonReplicaProcess` for more details.
290
- ///
291
- /// If the `config`'s vault type is `UnixSocket`, a `tokio_runtime_handle`
292
- /// must be provided, which is then used for the `async`hronous
293
- /// communication with the vault via RPC for secret key operations. In most
294
- /// cases, this is done by calling `tokio::runtime::Handle::block_on` and
295
- /// it is the caller's responsibility to ensure that these calls to
296
- /// `block_on` do not panic. This can be achieved, for example, by ensuring
297
- /// that the crypto component's methods are not themselves called from
298
- /// within a call to `block_on` (because calls to `block_on` cannot be
299
- /// nested), or by wrapping them with `tokio::task::block_in_place`
300
- /// and accepting the performance implications.
301
- /// Because the asynchronous communication with the vault happens only for
302
- /// secret key operations, for the `CryptoComponentImpl` the concerned
303
- /// methods are
304
- /// * `KeyManager::check_keys_with_registry`
305
- /// * `BasicSigner::sign_basic`
306
- ///
307
- /// The methods of the `TlsHandshake` trait are unaffected by this.
308
- ///
309
- /// # NOTE:
310
- /// Callers of this method are strongly encouraged to switch from using
311
- /// `CryptoComponentForNonReplicaProcess`, to using the full crypto component,
312
- /// by calling `new` instead of `new_for_non_replica_process`.
313
- ///
314
- /// # Panics
315
- /// Panics if the `config`'s vault type is `UnixSocket` and
316
- /// `tokio_runtime_handle` is `None`.
317
- pub fn new_for_non_replica_process (
318
- config : & CryptoConfig ,
319
- tokio_runtime_handle : Option < tokio:: runtime:: Handle > ,
320
- registry_client : Arc < dyn RegistryClient > ,
321
- logger : ReplicaLogger ,
322
- metrics_registry : Option < & MetricsRegistry > ,
323
- ) -> impl CryptoComponentForNonReplicaProcess {
324
- CryptoComponentImpl :: new (
325
- config,
326
- tokio_runtime_handle,
327
- registry_client,
328
- logger,
329
- metrics_registry,
330
- )
331
- }
332
-
333
246
/// Returns the `NodeId` of this crypto component.
334
247
pub fn get_node_id ( & self ) -> NodeId {
335
248
self . node_id
0 commit comments