Skip to content

NilClass error when signing xml #55

Description

@alanBAguero

This is the script I used to sign:

unsigned_xml = File.read("/home/path/unsigned.xml"); 0
private_key = OpenSSL::PKey::RSA.new(File.read("/home/path/certificates/alice.key")); 0
certificate = OpenSSL::X509::Certificate.new(File.read("/home/path/alice.crt")); 0
unsigned_document = Xmldsig::SignedDocument.new(unsigned_xml, id_attr: "Id"); 0
signed_xml = unsigned_document.sign(private_key)

But I'm getting a NoMethodError (undefined method remove' for nil:NilClass)`.
Do you know what might be the issue? Sorry, this is my first time working with XMLs and I'm kind of stuck
with this issue. If you could please help me, I'd appreciate it a lot!

Here's a gist with unsigned xml, certificate and private key: https://gist.github.com/alanBAguero/62d77ee45f14f15a16b376e08118ee18

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