Skip to content

Commit

Permalink
Make encryptedKeyData field optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Philonous committed Jul 22, 2022
1 parent 993e20d commit e3e664d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Network/Wai/SAML2/XML/Encrypted.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ data EncryptedKey = EncryptedKey {
-- | The method used to encrypt the key.
encryptedKeyMethod :: !EncryptionMethod,
-- | The key data.
encryptedKeyData :: !KeyInfo,
encryptedKeyData :: !(Maybe KeyInfo),
-- | The ciphertext.
encryptedKeyCipher :: !CipherData
} deriving (Eq, Show)
Expand All @@ -83,9 +83,9 @@ instance FromXML EncryptedKey where
cursor $/ element (xencName "EncryptionMethod")
) >>= parseXML

keyData <- oneOrFail "KeyInfo is required" (
cursor $/ element (dsName "KeyInfo")
) >>= parseXML
keyData <- case cursor $/ element (dsName "KeyInfo") of
[] -> return Nothing
(keyInfo :_) -> Just <$> parseXML keyInfo

cipher <- oneOrFail "CipherData is required" (
cursor $/ element (xencName "CipherData")
Expand Down

0 comments on commit e3e664d

Please sign in to comment.