Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | //! Verifies APK Signature Scheme V3 |
Alice Wang | af1d15b | 2022-09-09 11:09:51 +0000 | [diff] [blame] | 18 | //! |
| 19 | //! [v3 verification]: https://source.android.com/security/apksigning/v3#verification |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 20 | |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 21 | use anyhow::{ensure, Context, Result}; |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 22 | use bytes::Bytes; |
Andrew Scull | c208eb4 | 2022-05-22 16:17:52 +0000 | [diff] [blame] | 23 | use openssl::pkey::{self, PKey}; |
Alice Wang | 79713d9 | 2022-07-14 15:10:03 +0000 | [diff] [blame] | 24 | use openssl::x509::X509; |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 25 | use std::fs::File; |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 26 | use std::io::{Read, Seek}; |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 27 | use std::ops::Range; |
| 28 | use std::path::Path; |
| 29 | |
Alice Wang | 5d0f89a | 2022-09-15 15:06:10 +0000 | [diff] [blame] | 30 | use crate::algorithms::SignatureAlgorithmID; |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 31 | use crate::bytes_ext::{BytesExt, LengthPrefixed, ReadFromBytes}; |
Jooyung Han | 5b4c70e | 2021-08-09 16:36:13 +0900 | [diff] [blame] | 32 | use crate::sigutil::*; |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 33 | |
| 34 | pub const APK_SIGNATURE_SCHEME_V3_BLOCK_ID: u32 = 0xf05368c0; |
| 35 | |
Alice Wang | 9288935 | 2022-09-16 10:42:52 +0000 | [diff] [blame] | 36 | // TODO(b/190343842): get "ro.build.version.sdk" |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 37 | const SDK_INT: u32 = 31; |
| 38 | |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 39 | type Signers = LengthPrefixed<Vec<LengthPrefixed<Signer>>>; |
| 40 | |
| 41 | struct Signer { |
| 42 | signed_data: LengthPrefixed<Bytes>, // not verified yet |
| 43 | min_sdk: u32, |
| 44 | max_sdk: u32, |
| 45 | signatures: LengthPrefixed<Vec<LengthPrefixed<Signature>>>, |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 46 | public_key: PKey<pkey::Public>, |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | impl Signer { |
| 50 | fn sdk_range(&self) -> Range<u32> { |
| 51 | self.min_sdk..self.max_sdk |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | struct SignedData { |
| 56 | digests: LengthPrefixed<Vec<LengthPrefixed<Digest>>>, |
| 57 | certificates: LengthPrefixed<Vec<LengthPrefixed<X509Certificate>>>, |
| 58 | min_sdk: u32, |
| 59 | max_sdk: u32, |
Alice Wang | 4b7c0ba | 2022-09-07 15:12:36 +0000 | [diff] [blame] | 60 | #[allow(dead_code)] |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 61 | additional_attributes: LengthPrefixed<Vec<LengthPrefixed<AdditionalAttributes>>>, |
| 62 | } |
| 63 | |
| 64 | impl SignedData { |
| 65 | fn sdk_range(&self) -> Range<u32> { |
| 66 | self.min_sdk..self.max_sdk |
| 67 | } |
| 68 | } |
| 69 | |
Jooyung Han | 5b4c70e | 2021-08-09 16:36:13 +0900 | [diff] [blame] | 70 | #[derive(Debug)] |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 71 | struct Signature { |
Alice Wang | d73d0ff | 2022-09-20 11:33:30 +0000 | [diff] [blame] | 72 | /// Option is used here to allow us to ignore unsupported algorithm. |
| 73 | signature_algorithm_id: Option<SignatureAlgorithmID>, |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 74 | signature: LengthPrefixed<Bytes>, |
| 75 | } |
| 76 | |
| 77 | struct Digest { |
Alice Wang | d73d0ff | 2022-09-20 11:33:30 +0000 | [diff] [blame] | 78 | signature_algorithm_id: Option<SignatureAlgorithmID>, |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 79 | digest: LengthPrefixed<Bytes>, |
| 80 | } |
| 81 | |
| 82 | type X509Certificate = Bytes; |
| 83 | type AdditionalAttributes = Bytes; |
| 84 | |
Jiyong Park | a41535b | 2021-09-10 19:31:48 +0900 | [diff] [blame] | 85 | /// Verifies APK Signature Scheme v3 signatures of the provided APK and returns the public key |
Andrew Scull | f3fd4c6 | 2022-05-22 14:41:21 +0000 | [diff] [blame] | 86 | /// associated with the signer in DER format. |
Alice Wang | 3c01662 | 2022-09-19 09:08:27 +0000 | [diff] [blame] | 87 | pub fn verify<P: AsRef<Path>>(apk_path: P) -> Result<Box<[u8]>> { |
| 88 | let apk = File::open(apk_path.as_ref())?; |
| 89 | let mut sections = ApkSections::new(apk)?; |
Jiyong Park | a41535b | 2021-09-10 19:31:48 +0900 | [diff] [blame] | 90 | find_signer_and_then(&mut sections, |(signer, sections)| signer.verify(sections)) |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 91 | } |
| 92 | |
Jiyong Park | a41535b | 2021-09-10 19:31:48 +0900 | [diff] [blame] | 93 | /// Finds the supported signer and execute a function on it. |
| 94 | fn find_signer_and_then<R, U, F>(sections: &mut ApkSections<R>, f: F) -> Result<U> |
| 95 | where |
| 96 | R: Read + Seek, |
| 97 | F: FnOnce((&Signer, &mut ApkSections<R>)) -> Result<U>, |
| 98 | { |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 99 | let mut block = sections.find_signature(APK_SIGNATURE_SCHEME_V3_BLOCK_ID)?; |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 100 | // parse v3 scheme block |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 101 | let signers = block.read::<Signers>()?; |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 102 | |
| 103 | // find supported by platform |
Jiyong Park | a41535b | 2021-09-10 19:31:48 +0900 | [diff] [blame] | 104 | let supported = signers.iter().filter(|s| s.sdk_range().contains(&SDK_INT)).collect::<Vec<_>>(); |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 105 | |
| 106 | // there should be exactly one |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 107 | ensure!( |
| 108 | supported.len() == 1, |
| 109 | "APK Signature Scheme V3 only supports one signer: {} signers found.", |
| 110 | supported.len() |
| 111 | ); |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 112 | |
Jiyong Park | a41535b | 2021-09-10 19:31:48 +0900 | [diff] [blame] | 113 | // Call the supplied function |
| 114 | f((supported[0], sections)) |
| 115 | } |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 116 | |
Jiyong Park | a41535b | 2021-09-10 19:31:48 +0900 | [diff] [blame] | 117 | /// Gets the public key (in DER format) that was used to sign the given APK/APEX file |
Alice Wang | 3c01662 | 2022-09-19 09:08:27 +0000 | [diff] [blame] | 118 | pub fn get_public_key_der<P: AsRef<Path>>(apk_path: P) -> Result<Box<[u8]>> { |
| 119 | let apk = File::open(apk_path.as_ref())?; |
| 120 | let mut sections = ApkSections::new(apk)?; |
Jiyong Park | a41535b | 2021-09-10 19:31:48 +0900 | [diff] [blame] | 121 | find_signer_and_then(&mut sections, |(signer, _)| { |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 122 | Ok(signer.public_key.public_key_to_der()?.into_boxed_slice()) |
Jiyong Park | a41535b | 2021-09-10 19:31:48 +0900 | [diff] [blame] | 123 | }) |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 124 | } |
| 125 | |
Alice Wang | a94ba17 | 2022-09-08 15:25:31 +0000 | [diff] [blame] | 126 | /// Gets the v4 [apk_digest]. |
| 127 | /// |
| 128 | /// [apk_digest]: https://source.android.com/docs/security/apksigning/v4#apk-digest |
Alice Wang | 2ef3074 | 2022-09-19 11:59:17 +0000 | [diff] [blame] | 129 | pub fn pick_v4_apk_digest<R: Read + Seek>(apk: R) -> Result<(SignatureAlgorithmID, Box<[u8]>)> { |
Andrew Scull | a11b83a | 2022-06-01 09:23:13 +0000 | [diff] [blame] | 130 | let mut sections = ApkSections::new(apk)?; |
| 131 | let mut block = sections.find_signature(APK_SIGNATURE_SCHEME_V3_BLOCK_ID)?; |
| 132 | let signers = block.read::<Signers>()?; |
Alice Wang | a94ba17 | 2022-09-08 15:25:31 +0000 | [diff] [blame] | 133 | ensure!(signers.len() == 1, "should only have one signer"); |
Andrew Scull | a11b83a | 2022-06-01 09:23:13 +0000 | [diff] [blame] | 134 | signers[0].pick_v4_apk_digest() |
| 135 | } |
| 136 | |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 137 | impl Signer { |
Andrew Scull | 9173eb8 | 2022-06-01 09:17:14 +0000 | [diff] [blame] | 138 | /// Select the signature that uses the strongest algorithm according to the preferences of the |
| 139 | /// v4 signing scheme. |
| 140 | fn strongest_signature(&self) -> Result<&Signature> { |
| 141 | Ok(self |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 142 | .signatures |
| 143 | .iter() |
Alice Wang | d73d0ff | 2022-09-20 11:33:30 +0000 | [diff] [blame] | 144 | .filter(|sig| sig.signature_algorithm_id.is_some()) |
| 145 | .max_by_key(|sig| sig.signature_algorithm_id.unwrap().content_digest_algorithm()) |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 146 | .context("No supported signatures found")?) |
Andrew Scull | 9173eb8 | 2022-06-01 09:17:14 +0000 | [diff] [blame] | 147 | } |
| 148 | |
Alice Wang | 2ef3074 | 2022-09-19 11:59:17 +0000 | [diff] [blame] | 149 | fn pick_v4_apk_digest(&self) -> Result<(SignatureAlgorithmID, Box<[u8]>)> { |
Andrew Scull | a11b83a | 2022-06-01 09:23:13 +0000 | [diff] [blame] | 150 | let strongest = self.strongest_signature()?; |
| 151 | let signed_data: SignedData = self.signed_data.slice(..).read()?; |
| 152 | let digest = signed_data |
| 153 | .digests |
| 154 | .iter() |
| 155 | .find(|&dig| dig.signature_algorithm_id == strongest.signature_algorithm_id) |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 156 | .context("Digest not found")?; |
Alice Wang | d73d0ff | 2022-09-20 11:33:30 +0000 | [diff] [blame] | 157 | Ok(( |
| 158 | digest.signature_algorithm_id.context("Unsupported algorithm")?, |
| 159 | digest.digest.as_ref().to_vec().into_boxed_slice(), |
| 160 | )) |
Andrew Scull | a11b83a | 2022-06-01 09:23:13 +0000 | [diff] [blame] | 161 | } |
| 162 | |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 163 | /// Verifies the strongest signature from signatures against signed data using public key. |
| 164 | /// Returns the verified signed data. |
| 165 | fn verify_signature(&self, strongest: &Signature) -> Result<SignedData> { |
| 166 | let mut verifier = strongest |
| 167 | .signature_algorithm_id |
| 168 | .context("Unsupported algorithm")? |
| 169 | .new_verifier(&self.public_key)?; |
| 170 | verifier.update(&self.signed_data)?; |
| 171 | ensure!(verifier.verify(&strongest.signature)?, "Signature is invalid."); |
| 172 | // It is now safe to parse signed data. |
| 173 | self.signed_data.slice(..).read() |
| 174 | } |
| 175 | |
Alice Wang | af1d15b | 2022-09-09 11:09:51 +0000 | [diff] [blame] | 176 | /// The steps in this method implements APK Signature Scheme v3 verification step 3. |
Andrew Scull | 9173eb8 | 2022-06-01 09:17:14 +0000 | [diff] [blame] | 177 | fn verify<R: Read + Seek>(&self, sections: &mut ApkSections<R>) -> Result<Box<[u8]>> { |
| 178 | // 1. Choose the strongest supported signature algorithm ID from signatures. |
| 179 | let strongest = self.strongest_signature()?; |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 180 | |
| 181 | // 2. Verify the corresponding signature from signatures against signed data using public key. |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 182 | let verified_signed_data = self.verify_signature(strongest)?; |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 183 | |
| 184 | // 3. Verify the min and max SDK versions in the signed data match those specified for the |
| 185 | // signer. |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 186 | ensure!( |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 187 | self.sdk_range() == verified_signed_data.sdk_range(), |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 188 | "SDK versions mismatch between signed and unsigned in v3 signer block." |
| 189 | ); |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 190 | |
| 191 | // 4. Verify that the ordered list of signature algorithm IDs in digests and signatures is |
| 192 | // identical. (This is to prevent signature stripping/addition.) |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 193 | ensure!( |
| 194 | self.signatures |
| 195 | .iter() |
| 196 | .map(|sig| sig.signature_algorithm_id) |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 197 | .eq(verified_signed_data.digests.iter().map(|dig| dig.signature_algorithm_id)), |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 198 | "Signature algorithms don't match between digests and signatures records" |
| 199 | ); |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 200 | |
| 201 | // 5. Compute the digest of APK contents using the same digest algorithm as the digest |
| 202 | // algorithm used by the signature algorithm. |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 203 | let digest = verified_signed_data |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 204 | .digests |
| 205 | .iter() |
| 206 | .find(|&dig| dig.signature_algorithm_id == strongest.signature_algorithm_id) |
| 207 | .unwrap(); // ok to unwrap since we check if two lists are the same above |
Alice Wang | d73d0ff | 2022-09-20 11:33:30 +0000 | [diff] [blame] | 208 | let computed = sections |
| 209 | .compute_digest(digest.signature_algorithm_id.context("Unsupported algorithm")?)?; |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 210 | |
| 211 | // 6. Verify that the computed digest is identical to the corresponding digest from digests. |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 212 | ensure!( |
| 213 | computed == digest.digest.as_ref(), |
| 214 | "Digest mismatch: computed={:?} vs expected={:?}", |
| 215 | to_hex_string(&computed), |
| 216 | to_hex_string(&digest.digest), |
| 217 | ); |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 218 | |
Alice Wang | 79713d9 | 2022-07-14 15:10:03 +0000 | [diff] [blame] | 219 | // 7. Verify that public key of the first certificate of certificates is identical |
Jooyung Han | 543e712 | 2021-08-11 01:48:45 +0900 | [diff] [blame] | 220 | // to public key. |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 221 | let cert = verified_signed_data.certificates.first().context("No certificates listed")?; |
Alice Wang | 79713d9 | 2022-07-14 15:10:03 +0000 | [diff] [blame] | 222 | let cert = X509::from_der(cert.as_ref())?; |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 223 | ensure!( |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 224 | cert.public_key()?.public_eq(&self.public_key), |
Alice Wang | bc4b9a9 | 2022-09-16 13:13:18 +0000 | [diff] [blame] | 225 | "Public key mismatch between certificate and signature record" |
| 226 | ); |
Jooyung Han | 543e712 | 2021-08-11 01:48:45 +0900 | [diff] [blame] | 227 | |
Alice Wang | 9288935 | 2022-09-16 10:42:52 +0000 | [diff] [blame] | 228 | // TODO(b/245914104) |
| 229 | // 8. If the proof-of-rotation attribute exists for the signer verify that the |
| 230 | // struct is valid and this signer is the last certificate in the list. |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 231 | Ok(self.public_key.public_key_to_der()?.into_boxed_slice()) |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 232 | } |
| 233 | } |
| 234 | |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 235 | // ReadFromBytes implementations |
Alice Wang | 9288935 | 2022-09-16 10:42:52 +0000 | [diff] [blame] | 236 | // TODO(b/190343842): add derive macro: #[derive(ReadFromBytes)] |
Jooyung Han | 12a0b70 | 2021-08-05 23:20:31 +0900 | [diff] [blame] | 237 | |
| 238 | impl ReadFromBytes for Signer { |
| 239 | fn read_from_bytes(buf: &mut Bytes) -> Result<Self> { |
| 240 | Ok(Self { |
| 241 | signed_data: buf.read()?, |
| 242 | min_sdk: buf.read()?, |
| 243 | max_sdk: buf.read()?, |
| 244 | signatures: buf.read()?, |
| 245 | public_key: buf.read()?, |
| 246 | }) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | impl ReadFromBytes for SignedData { |
| 251 | fn read_from_bytes(buf: &mut Bytes) -> Result<Self> { |
| 252 | Ok(Self { |
| 253 | digests: buf.read()?, |
| 254 | certificates: buf.read()?, |
| 255 | min_sdk: buf.read()?, |
| 256 | max_sdk: buf.read()?, |
| 257 | additional_attributes: buf.read()?, |
| 258 | }) |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | impl ReadFromBytes for Signature { |
| 263 | fn read_from_bytes(buf: &mut Bytes) -> Result<Self> { |
| 264 | Ok(Signature { signature_algorithm_id: buf.read()?, signature: buf.read()? }) |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | impl ReadFromBytes for Digest { |
| 269 | fn read_from_bytes(buf: &mut Bytes) -> Result<Self> { |
| 270 | Ok(Self { signature_algorithm_id: buf.read()?, digest: buf.read()? }) |
| 271 | } |
| 272 | } |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 273 | |
Alice Wang | a7cac42 | 2022-09-20 13:57:32 +0000 | [diff] [blame] | 274 | impl ReadFromBytes for PKey<pkey::Public> { |
| 275 | fn read_from_bytes(buf: &mut Bytes) -> Result<Self> { |
| 276 | let raw_public_key = buf.read::<LengthPrefixed<Bytes>>()?; |
| 277 | Ok(PKey::public_key_from_der(raw_public_key.as_ref())?) |
| 278 | } |
| 279 | } |
| 280 | |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 281 | #[inline] |
Alice Wang | 9807322 | 2022-09-09 14:08:19 +0000 | [diff] [blame] | 282 | pub(crate) fn to_hex_string(buf: &[u8]) -> String { |
Jooyung Han | d839785 | 2021-08-10 16:29:36 +0900 | [diff] [blame] | 283 | buf.iter().map(|b| format!("{:02X}", b)).collect() |
| 284 | } |