+
Skip to content

Cannot load custom DigestAlgorithm class #7218

@alexeykoren

Description

@alexeykoren

There is a HashAgility tool that allows for setting custom digest algorithms.

There might be a slight problem: inside init method it tries to call
DigestAlgorithmFactory.registerClass(customDigestAlgorithmClassName)
which tries to instantiate
CustomAlgorithmFactory(customDigestAlgorithmClassName)
which tries to instantiate CustomDigestAlgorithm via constructor that it gets from reflection using
this.classLoader

Problem seems to be that CustomAlgorithmFactory is loaded using node's core class loader that normally doesn't include any cordapp classes. So if CustomDigestAlgorithm is defined in a cordapp - it cannot be loaded. So one can only do hash agility with forking the Corda node which is not a desired way.

Also DigestAlgorithmFactory is sealed, and CustomAlgorithmFactory is private so the ability of overriding this behaviour is limited.

Potential solution might be to extend HashAgility and DigestAlgorithmFactory to be able to receive either the very class or just class loader.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载