@@ -7,6 +7,7 @@ var moment = require('moment');
77var async = require ( 'async' ) ;
88var crypto = require ( 'crypto' ) ;
99
10+ var EncryptXml = require ( './xml/encrypt' ) ;
1011var SignXml = require ( './xml/sign' ) ;
1112
1213var saml11 = fs . readFileSync ( path . join ( __dirname , 'saml11.template' ) ) . toString ( ) ;
@@ -176,39 +177,6 @@ function createAssertion(options, strategies, callback) {
176177 } ) ;
177178}
178179
179- var EncryptXml = Object . freeze ( {
180- fromEncryptXmlOptions : function ( options ) {
181- if ( ! options . encryptionCert ) {
182- return this . unencrypted ;
183- } else {
184- var encryptOptions = {
185- rsa_pub : options . encryptionPublicKey ,
186- pem : options . encryptionCert ,
187- encryptionAlgorithm : options . encryptionAlgorithm || 'http://www.w3.org/2001/04/xmlenc#aes256-cbc' ,
188- keyEncryptionAlgorighm : options . keyEncryptionAlgorighm || 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p' ,
189- } ;
190-
191- // expose the encryptOptions as these are needed when adding the SubjectConfirmation
192- return Object . assign ( this . encrypted ( encryptOptions ) , { encryptOptions : encryptOptions } ) ;
193- }
194- } ,
195- unencrypted : function ( xml , callback ) {
196- if ( callback ) {
197- setImmediate ( callback , null , xml ) ;
198- } else {
199- return xml ;
200- }
201- } ,
202- encrypted : function ( encryptOptions ) {
203- return function encrypt ( xml , callback ) {
204- xmlenc . encrypt ( xml , encryptOptions , function ( err , encrypted ) {
205- if ( err ) return callback ( err ) ;
206- callback ( null , utils . removeWhitespace ( encrypted ) ) ;
207- } ) ;
208- } ;
209- }
210- } )
211-
212180function addSubjectConfirmation ( encryptOptions , doc , randomBytes , callback ) {
213181 xmlenc . encryptKeyInfo ( randomBytes , encryptOptions , function ( err , keyinfo ) {
214182 if ( err ) return callback ( err ) ;
0 commit comments