{"action":"created","issue":{"url":"https://api.github.com/repos/digidentity/libsaml/issues/79","labels_url":"https://api.github.com/repos/digidentity/libsaml/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/digidentity/libsaml/issues/79/comments","events_url":"https://api.github.com/repos/digidentity/libsaml/issues/79/events","html_url":"https://github.com/digidentity/libsaml/issues/79","id":117514981,"number":79,"title":"How to populate DigestValue in the signed Info.","user":{"login":"sahild","id":354781,"avatar_url":"https://avatars.githubusercontent.com/u/354781?v=3","gravatar_id":"","url":"https://api.github.com/users/sahild","html_url":"https://github.com/sahild","followers_url":"https://api.github.com/users/sahild/followers","following_url":"https://api.github.com/users/sahild/following{/other_user}","gists_url":"https://api.github.com/users/sahild/gists{/gist_id}","starred_url":"https://api.github.com/users/sahild/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sahild/subscriptions","organizations_url":"https://api.github.com/users/sahild/orgs","repos_url":"https://api.github.com/users/sahild/repos","events_url":"https://api.github.com/users/sahild/events{/privacy}","received_events_url":"https://api.github.com/users/sahild/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-11-18T05:14:15Z","updated_at":"2015-11-18T12:47:00Z","closed_at":null,"body":"I am trying to add a siginature using `add_signature` present here:\r\nhttps://github.com/digidentity/libsaml/blob/master/lib/saml/xml_helpers.rb#L5\r\n\r\nbut i am not sure where and how to calculate digest_value that is being passed to `SignedInfo` here:\r\nhttps://github.com/digidentity/libsaml/blob/master/lib/saml/elements/signature.rb#L27\r\n\r\nand hence DigestValue node in my final SAML node is always empty:\r\n`<ds:DigestValue/>`\r\n\r\nI am pretty sure i am doing something wrong but could not find anything in the code to figure this out.\r\n\r\nIs it possible to add an example somewhere regarding this.\r\n\r\nIf you can let me know i can add a wiki page for the gem regarding this.\r\n"},"comment":{"url":"https://api.github.com/repos/digidentity/libsaml/issues/comments/157701527","html_url":"https://github.com/digidentity/libsaml/issues/79#issuecomment-157701527","issue_url":"https://api.github.com/repos/digidentity/libsaml/issues/79","id":157701527,"user":{"login":"benoist","id":7202,"avatar_url":"https://avatars.githubusercontent.com/u/7202?v=3","gravatar_id":"","url":"https://api.github.com/users/benoist","html_url":"https://github.com/benoist","followers_url":"https://api.github.com/users/benoist/followers","following_url":"https://api.github.com/users/benoist/following{/other_user}","gists_url":"https://api.github.com/users/benoist/gists{/gist_id}","starred_url":"https://api.github.com/users/benoist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benoist/subscriptions","organizations_url":"https://api.github.com/users/benoist/orgs","repos_url":"https://api.github.com/users/benoist/repos","events_url":"https://api.github.com/users/benoist/events{/privacy}","received_events_url":"https://api.github.com/users/benoist/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T12:47:00Z","updated_at":"2015-11-18T12:47:00Z","body":"No worries :)\r\n\r\nNo that is not supported as it goes against the SAML security considerations. All outermost messages SHOULD be signed. So if you really want to do it without (and I'd strongly advice you not to do that), you'd have to copy the code from the binding and the sign function and omit the add_signature line. Something like this would work:\r\n\r\n```ruby\r\ndef create_form_attributes(message, options = {})\r\n  param = message.is_a?(Saml::ComplexTypes::StatusResponseType) ? \"SAMLResponse\" : \"SAMLRequest\"\r\n  \r\n  document = Xmldsig::SignedDocument.new(message.send(\"to_#{format}\"))\r\n  signed_message = document.sign do |data, signature_algorithm|\r\n    message.provider.sign(signature_algorithm, data)\r\n  end\r\n\r\n  variables        = {}\r\n  variables[param] = Saml::Encoding.encode_64(signed_message)\r\n  variables[\"RelayState\"] = options[:relay_state] if options[:relay_state]\r\n\r\n  {\r\n      location:  message.destination,\r\n      variables: variables\r\n  }\r\nend\r\n```\r\n\r\nI must say again, this is really not save! No client should allow unsigned message.\r\n\r\nCheers\r\nBenoist"}}