Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions der/src/asn1/bit_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ impl FixedTag for BitStringRef<'_> {
/// contains unused bits prefix and therefore cannot be a simple `&'a BitStringRef` slice.
pub trait AsBitStringRef {
/// Borrows the owned or ref `BIT STRING` as [`BitStringRef`]
fn as_bit_string(&self) -> BitStringRef<'_>;
fn as_bit_string_ref(&self) -> BitStringRef<'_>;
}

impl AsBitStringRef for BitStringRef<'_> {
fn as_bit_string(&self) -> BitStringRef<'_> {
fn as_bit_string_ref(&self) -> BitStringRef<'_> {
*self
}
}
Expand Down Expand Up @@ -576,7 +576,7 @@ mod allocating {
}

impl AsBitStringRef for BitString {
fn as_bit_string(&self) -> BitStringRef<'_> {
fn as_bit_string_ref(&self) -> BitStringRef<'_> {
BitStringRef::from(self)
}
}
Expand Down
28 changes: 17 additions & 11 deletions pkcs8/src/private_key_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::fmt;
use der::{
Decode, DecodeValue, Encode, EncodeValue, FixedTag, Header, Length, Reader, Sequence, TagMode,
TagNumber, Writer,
asn1::{AnyRef, BitStringRef, ContextSpecific, OctetStringRef, SequenceRef},
asn1::{AnyRef, AsBitStringRef, BitStringRef, ContextSpecific, OctetStringRef, SequenceRef},
};
use spki::AlgorithmIdentifier;

Expand Down Expand Up @@ -159,6 +159,7 @@ impl<Params, Key, PubKey> PrivateKeyInfo<Params, Key, PubKey> {
}
}

#[allow(deprecated)]
impl<'a, Params, Key, PubKey> PrivateKeyInfo<Params, Key, PubKey>
where
Params: der::Choice<'a, Error = der::Error> + Encode,
Expand Down Expand Up @@ -219,6 +220,7 @@ where
}
}

#[allow(deprecated)]
impl<'a, Params, Key, PubKey> PrivateKeyInfo<Params, Key, PubKey>
where
Params: der::Choice<'a> + Encode,
Expand Down Expand Up @@ -279,6 +281,7 @@ where
}
}

#[allow(deprecated)]
impl<'a, Params, Key, PubKey> EncodeValue for PrivateKeyInfo<Params, Key, PubKey>
where
Params: der::Choice<'a, Error = der::Error> + Encode,
Expand All @@ -301,6 +304,7 @@ where
}
}

#[allow(deprecated)]
impl<'a, Params, Key, PubKey> Sequence<'a> for PrivateKeyInfo<Params, Key, PubKey>
where
Params: der::Choice<'a, Error = der::Error> + Encode,
Expand All @@ -311,6 +315,7 @@ where
{
}

#[allow(deprecated)]
impl<'a, Params, Key, PubKey> TryFrom<&'a [u8]> for PrivateKeyInfo<Params, Key, PubKey>
where
Params: der::Choice<'a, Error = der::Error> + Encode,
Expand Down Expand Up @@ -341,6 +346,7 @@ where
}

#[cfg(feature = "alloc")]
#[allow(deprecated)]
impl<'a, Params, Key, PubKey> TryFrom<PrivateKeyInfo<Params, Key, PubKey>> for SecretDocument
where
Params: der::Choice<'a, Error = der::Error> + Encode,
Expand All @@ -357,6 +363,7 @@ where
}

#[cfg(feature = "alloc")]
#[allow(deprecated)]
impl<'a, Params, Key, PubKey> TryFrom<&PrivateKeyInfo<Params, Key, PubKey>> for SecretDocument
where
Params: der::Choice<'a, Error = der::Error> + Encode,
Expand Down Expand Up @@ -444,15 +451,20 @@ pub type PrivateKeyInfoRef<'a> = PrivateKeyInfo<AnyRef<'a>, &'a OctetStringRef,

/// [`BitStringLike`] marks object that will act like a `BitString`.
///
/// It will allow to get a [`BitStringRef`] that points back to the underlying bytes.
// TODO(tarcieri): replace this with `AsRef<BitStringRef>` when we can have `&BitStringRef`.
/// Note: this trait was replaced by [`AsBitStringRef`]
#[deprecated(since = "0.11.1", note = "Use `AsBitStringRef` instead")]
// TODO: replace this with `der::asn1::AsBitStringRef`
pub trait BitStringLike {
fn as_bit_string(&self) -> BitStringRef<'_>;
}

impl BitStringLike for BitStringRef<'_> {
#[allow(deprecated)]
impl<T> BitStringLike for T
where
T: AsBitStringRef,
{
fn as_bit_string(&self) -> BitStringRef<'_> {
BitStringRef::from(self)
self.as_bit_string_ref()
}
}

Expand Down Expand Up @@ -546,10 +558,4 @@ pub(crate) mod allocating {
}
}
}

impl BitStringLike for BitString {
fn as_bit_string(&self) -> BitStringRef<'_> {
BitStringRef::from(self)
}
}
}
Loading