Skip to content
This repository has been archived by the owner on Feb 21, 2024. It is now read-only.

Commit

Permalink
fix: add support ECDSA with SHA384 attestations
Browse files Browse the repository at this point in the history
  • Loading branch information
RomarQ committed Feb 23, 2023
1 parent 87a8b35 commit b06bc69
Showing 1 changed file with 54 additions and 11 deletions.
65 changes: 54 additions & 11 deletions pallets/acurast/common/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ pub fn extract_attestation<'a>(
}

const RSA_ALGORITHM: ObjectIdentifier = oid!(1, 2, 840, 113549, 1, 1, 11);
const ECDSA_ALGORITHM: ObjectIdentifier = oid!(1, 2, 840, 10045, 4, 3, 2);
const ECDSA_WITH_SHA256_ALGORITHM: ObjectIdentifier = oid!(1, 2, 840, 10045, 4, 3, 2); // https://oidref.com/1.2.840.10045.4.3.2
const ECDSA_WITH_SHA384_ALGORITHM: ObjectIdentifier = oid!(1, 2, 840, 10045, 4, 3, 3); // https://oidref.com/1.2.840.10045.4.3.3

const RSA_PBK: ObjectIdentifier = oid!(1, 2, 840, 113549, 1, 1, 1);
const ECDSA_PBK: ObjectIdentifier = oid!(1, 2, 840, 10045, 2, 1);
Expand Down Expand Up @@ -148,7 +149,10 @@ impl PublicKey {
};
Ok(PublicKey::ECDSA(ECDSACurve::CurveP384(point)))
}
_ => Result::Err(ValidationError::UnsupportedSignatureAlgorithm)?,
_ => {
dbg!(typ);
Result::Err(ValidationError::UnsupportedSignatureAlgorithm)?
}
}
}
_ => Result::Err(ValidationError::UnsupportedPublicKeyAlgorithm),
Expand All @@ -172,11 +176,18 @@ fn validate<'a>(
PublicKey::RSA(pbk) => validate_rsa(&payload, &cert.signature_value, &pbk),
_ => Err(ValidationError::UnsupportedPublicKeyAlgorithm),
},
ECDSA_ALGORITHM => match pbk {
PublicKey::ECDSA(pbk) => validate_ecdsa(&payload, &cert.signature_value, &pbk),
ECDSA_WITH_SHA256_ALGORITHM => match pbk {
PublicKey::ECDSA(pbk) => validate_ecdsa_sha256(&payload, &cert.signature_value, &pbk),
_ => Err(ValidationError::UnsupportedPublicKeyAlgorithm),
},
ECDSA_WITH_SHA384_ALGORITHM => match pbk {
PublicKey::ECDSA(pbk) => validate_ecdsa_sha384(&payload, &cert.signature_value, &pbk),
_ => Err(ValidationError::UnsupportedPublicKeyAlgorithm),
},
_ => Err(ValidationError::UnsupportedSignatureAlgorithm),
_ => {
dbg!(&cert.signature_algorithm.algorithm);
Err(ValidationError::UnsupportedSignatureAlgorithm)?
}
}
}

Expand All @@ -203,7 +214,7 @@ fn validate_rsa(
Ok(())
}

fn validate_ecdsa(
fn validate_ecdsa_sha256(
payload: &[u8],
signature: &BitString,
curve: &ECDSACurve,
Expand Down Expand Up @@ -234,6 +245,35 @@ fn validate_ecdsa(
Ok(())
}

fn validate_ecdsa_sha384(
payload: &[u8],
signature: &BitString,
curve: &ECDSACurve,
) -> Result<(), ValidationError> {
match curve {
ECDSACurve::CurveP256(verifying_key) => {
let signature = p256::ecdsa::Signature::from_der(&signature.as_bytes())
.or(Err(ValidationError::InvalidSignatureEncoding))?;
verifying_key
.verify(payload, &signature)
.or(Err(ValidationError::InvalidSignature))?;
}
ECDSACurve::CurveP384(affine_point) => {
let signature = ecdsa_vendored::Signature::from_der(signature.as_bytes())
.or(Err(ValidationError::InvalidSignatureEncoding))?;

let hashed = &sha2::Sha384::digest(payload);
let payload = p384::FieldBytes::from_slice(&hashed);

affine_point
.verify_prehashed(*payload, &signature)
.or(Err(ValidationError::InvalidSignature))?;
}
};

Ok(())
}

fn parse_rsa_pbk(data: &[u8]) -> Result<RSAPbk, ParseError> {
let pbk = asn1::parse_single::<RSAPublicKey>(data)?;
Ok(RSAPbk {
Expand Down Expand Up @@ -349,7 +389,6 @@ mod tests {
const PIXEL_ROOT_CERT: &str = r"MIIFYDCCA0igAwIBAgIJAOj6GWMU0voYMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNVBAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTYwNTI2MTYyODUyWhc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TdOLU8YRvMYdEvYebWHMpvwGCF6bAx3JBpIeOQ1wDB5y0USicV3YgYGmi+NZfhA4URSh77Yd6uuJOJENRaNVTzl";
Expand Down Expand Up @@ -387,10 +426,11 @@ mod tests {
#[test]
fn test_validate_pixel_chain() -> Result<(), Error> {
let chain = vec![
PIXEL_ROOT_CERT,
PIXEL_INTERMEDIATE_2_CERT,
PIXEL_INTERMEDIATE_1_CERT,
PIXEL_KEY_CERT,
r"MIIFHDCCAwSgAwIBAgIJANUP8luj8tazMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNVBAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTkxMTIyMjAzNzU4WhcNMzQxMTE4MjAzNzU4WjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdSSxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7tv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggjnar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGqC4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQoVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+OJtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/EgsTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRiigHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+MRPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+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hAKrBWhDSmo/HgT9JSS+KagGBkiNrpa2VbrDQqYWQwS0d",
];
let decoded_chain = decode_certificate_chain(&chain);
validate_certificate_chain_root(&decoded_chain).expect("validating root failed");
Expand All @@ -401,6 +441,9 @@ mod tests {
KeyDescription::V4(key_description) => {
assert_eq!(key_description.attestation_version, 4)
}
KeyDescription::V200(key_description) => {
assert_eq!(key_description.attestation_version, 200)
}
_ => return Err(()),
}
let _: BoundedKeyDescription = key_description.try_into()?;
Expand Down

0 comments on commit b06bc69

Please sign in to comment.