Skip to content

IDE and test complaints about argument types #3

Description

@miken32

I realize this is dead code, but it's still working well for us. A couple of slight bugs that my IDE complains about:

  1. SignatureAlgorithmIdentifierFactory::algoForAsymmetricCrypto() expects an object that implements AsymmetricCryptoAlgorithmIdentifier. However, none of the other object properties use this interface for their property definitions; instead they are using its parent interface AlgorithmIdentifierType. This works in practice but is technically incorrect. We changed the type for the argument to this method and it works without complaint. (A more correct fix would probably be to define the object properties in question, e.g. OneAsymmetricKey::_algo, as AsymmetricCryptoAlgorithmIdentifier, but I don't have the SME to confidently make those changes.)

  2. PrivateKeyInfo::fromPEM() returns an instance of OneAsymmetricKey but most methods instead expect an instance of PrivateKeyInfo in their signatures. Since PrivateKeyInfo inherits from OneAsymmetricKey without any changes, we changed all the types in PrivateKey to expect the less-specific class. (As above, there is probably a better solution such as settling on one class or creating an interface.)

Will open a PR just for the sake of anyone else who comes across this.

See also sop/x509#10 and sop/crypto-bridge#2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions