@@ -11,11 +11,11 @@ use hmac::{Hmac, Mac};
11
11
use ic_cdk:: println;
12
12
use pkcs8:: der:: zeroize:: Zeroizing ;
13
13
use std:: error:: Error ;
14
- #[ cfg( target_arch = "x86_64" ) ]
14
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
15
15
use std:: io:: Read ;
16
- #[ cfg( target_arch = "x86_64" ) ]
16
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
17
17
use std:: io:: Write ;
18
- #[ cfg( target_arch = "x86_64" ) ]
18
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
19
19
use std:: path:: PathBuf ;
20
20
21
21
use crate :: ED25519_SIGN_CONTEXT ;
@@ -218,7 +218,7 @@ impl DccIdentity {
218
218
. replace ( '\n' , "" )
219
219
}
220
220
221
- #[ cfg( target_arch = "x86_64" ) ]
221
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
222
222
pub fn write_verifying_key_to_pem_file ( & self , file_path : & PathBuf ) -> Result < ( ) , CryptoError > {
223
223
let pem_string = self . verifying_key_as_pem ( ) ;
224
224
@@ -246,7 +246,7 @@ impl DccIdentity {
246
246
Ok ( pem:: encode ( & pem_obj) )
247
247
}
248
248
249
- #[ cfg( target_arch = "x86_64" ) ]
249
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
250
250
pub fn write_signing_key_to_pem_file ( & self , file_path : & PathBuf ) -> Result < ( ) , CryptoError > {
251
251
let pem_string = self . signing_key_as_pem_string ( ) ?;
252
252
@@ -257,15 +257,15 @@ impl DccIdentity {
257
257
Ok ( ( ) )
258
258
}
259
259
260
- #[ cfg( target_arch = "x86_64" ) ]
260
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
261
261
pub fn identities_dir ( ) -> PathBuf {
262
262
dirs:: home_dir ( )
263
263
. expect ( "Failed to find home directory" )
264
264
. join ( ".dcc" )
265
265
. join ( "identity" )
266
266
}
267
267
268
- #[ cfg( target_arch = "x86_64" ) ]
268
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
269
269
pub fn save_to_dir ( & self , identity : & str ) -> Result < ( ) , CryptoError > {
270
270
let identity_dir = Self :: identities_dir ( ) . join ( identity) ;
271
271
@@ -290,7 +290,7 @@ impl DccIdentity {
290
290
Ok ( ( ) )
291
291
}
292
292
293
- #[ cfg( target_arch = "x86_64" ) ]
293
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
294
294
fn read_signing_key_from_pem_file ( file_path : & PathBuf ) -> Result < SigningKey , CryptoError > {
295
295
let mut file = fs_err:: File :: open ( file_path) ?;
296
296
let mut pem_string = String :: new ( ) ;
@@ -305,7 +305,7 @@ impl DccIdentity {
305
305
Ok ( key)
306
306
}
307
307
308
- #[ cfg( target_arch = "x86_64" ) ]
308
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
309
309
fn read_verifying_key_from_pem_file ( file_path : & PathBuf ) -> Result < VerifyingKey , CryptoError > {
310
310
let mut file = fs_err:: File :: open ( file_path) ?;
311
311
let mut pem_string = String :: new ( ) ;
@@ -327,7 +327,7 @@ impl DccIdentity {
327
327
Ok ( key)
328
328
}
329
329
330
- #[ cfg( target_arch = "x86_64" ) ]
330
+ #[ cfg( any ( target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
331
331
pub fn load_from_dir ( identity_dir : & PathBuf ) -> Result < Self , CryptoError > {
332
332
let identity_dir = if identity_dir. is_absolute ( ) {
333
333
identity_dir. to_path_buf ( )
0 commit comments