Skip to content

Confusion over pkcs1v15::VerifyingKey::new vs ::new_with_prefix #238

Closed

Description

@tarcieri

In #234 we had some people confused about signature verification failing with ::new, and they had trouble discovering ::new_with_prefix.

It would be good to either improve the documentation here, or eliminate the distinction between ::new and ::new_with_prefix and automatically determining if the prefix is needed (e.g. based on the OID of the provided digest).

It seems like other RSA libraries are able to make this determination automatically.

Activity

  1. dignifiedquire commented on Jan 6, 2023

    @dignifiedquire
    Member

    I think it would be great if we had

    • new() -> determines it automatically
    • new_prefix(p: Prefix) explicitly expects a prefix or not. With enum Prefix { Yes, No } (names can be bikeshedded) for when you want to enforce one or the other.
  2. tarcieri commented on Jan 6, 2023

    @tarcieri
    MemberAuthor

    I think part of the rationale for the current split is avoiding the need to have an AssociatedOid on the digest used. However, that just seems to be causing confusion.

    Looking at RFC8017 Appendix 2.4, I'm unclear under what circumstances the OID can actually be omitted?

    So perhaps the current new should be renamed to something like new_unprefixed, and new_with_prefixed should be renamed to new?

  3. added a commit that references this issue on Apr 10, 2023
    ee09aab
  4. added a commit that references this issue on Apr 11, 2023
    bf1defd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apidiscussionenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions