blob: a013fba0f8781be0e7290f372099557d9d8c4c71 [file] [log] [blame]
Alice Wang000595b2023-10-02 13:46:45 +00001// Copyright 2023, The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use bssl_avf::{EcKey, Result};
16
17#[test]
18fn ec_private_key_serialization() -> Result<()> {
19 let ec_key = EcKey::new_p256()?;
20 let der_encoded_ec_private_key = ec_key.ec_private_key()?;
21 let deserialized_ec_key = EcKey::from_ec_private_key(der_encoded_ec_private_key.as_slice())?;
22
23 assert_eq!(ec_key.cose_public_key()?, deserialized_ec_key.cose_public_key()?);
24 Ok(())
25}