Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Decrypt XML Elements with Asymmetric Keys

$
0
0

Something like the following should work:

      $set ilusing"System.Xml" 
      $set ilusing"System.Security.Cryptography"
      $set ilusing"System.Security.Cryptography.Xml"
       class-id vbdecrypt.Class1.
       working-storage section.

       method-id Decrypt.
       local-storage section.
       procedure division using by value Doc as type XmlDocument
                                by value Alg as type RSA
                                by value KeyName as string.
        *> Check the arguments.  

           If KeyName = ""
            Raise New ArgumentNullException("KeyName")
           End-If
        *> Create a new EncryptedXml object.
           declare exml as type EncryptedXml = new EncryptedXml(Doc)
        *> Add a key-name mapping.
        *> This method can only decrypt documents
        *> that present the specified key name.
           invoke exml::AddKeyNameMapping(KeyName, Alg)
        *> Decrypt the element.
           invoke exml::DecryptDocument
    
           goback.
       end method.
    
       end class.

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>