@@ -28,7 +28,6 @@ import GHC.Stack
2828import Control.Applicative ((<|>) )
2929import Control.Exception (SomeException , handle )
3030import Control.Monad ((<=<) )
31- import Control.Monad.Except
3231import Crypto.Number.Serialize (i2ospOf_ , os2ip )
3332import Crypto.Hash (hashlazy , SHA1 (.. ), SHA256 (.. ), SHA512 (.. ), RIPEMD160 (.. ))
3433import qualified Crypto.PubKey.DSA as DSA
@@ -40,6 +39,7 @@ import qualified Data.ByteString.Base64 as Base64
4039import qualified Data.ByteString.Lazy as BSL
4140import qualified Data.List.NonEmpty as NonEmpty
4241import Data.Either (isRight )
42+ import Data.Maybe (listToMaybe )
4343import Network.URI (URI (.. ))
4444import qualified Text.XML.HXT.Core as HXT
4545import qualified Text.XML.HXT.DOM.ShowXml as DOM
@@ -72,7 +72,9 @@ applyTransformsXML (Transform (Identified (TransformCanonicalization a)) ins x :
7272applyTransformsXML (Transform (Identified TransformEnvelopedSignature ) Nothing [] : tl) =
7373 -- XXX assumes "this" signature in top-level
7474 applyTransformsXML tl
75- . head . HXT. runLA (HXT. processChildren $ HXT. processChildren
75+ . maybe (error " applyTransformsXML: EnvelopedSignature transform produced no result" ) id
76+ . listToMaybe
77+ . HXT. runLA (HXT. processChildren $ HXT. processChildren
7678 $ HXT. neg (isDSElem " Signature" ))
7779applyTransformsXML tl = applyTransformsBytes tl . DOM. xshowBlob . return
7880
0 commit comments