@@ -49,7 +49,7 @@ function Crypto(config) {
4949 * @param encryptionParams encryption parameters
5050 */
5151 this . encryptData = function ( options , encryptionParams ) {
52- let data = utils . jsonToString ( options . data ) ;
52+ const data = utils . jsonToString ( options . data ) ;
5353
5454 // Generate encryption params
5555 const enc = encryptionParams || this . newEncryptionParams ( options ) ;
@@ -173,7 +173,7 @@ function generateSecretKey(algorithm, size, digest) {
173173 * @private
174174 */
175175function loadPrivateKey ( privateKeyPath ) {
176- let privateKeyContent = fs . readFileSync ( privateKeyPath , 'binary' ) ;
176+ const privateKeyContent = fs . readFileSync ( privateKeyPath , 'binary' ) ;
177177
178178 if ( ! privateKeyContent || privateKeyContent . length <= 1 ) {
179179 throw new Error ( 'Private key content not valid' ) ;
@@ -186,7 +186,7 @@ function loadPrivateKey(privateKeyPath) {
186186 * @private
187187 */
188188function readPublicCertificate ( publicCertificatePath ) {
189- let certificateContent = fs . readFileSync ( publicCertificatePath ) ;
189+ const certificateContent = fs . readFileSync ( publicCertificatePath ) ;
190190 if ( ! certificateContent || certificateContent . length <= 1 ) {
191191 throw new Error ( 'Public certificate content is not valid' ) ;
192192 }
@@ -197,7 +197,7 @@ function readPublicCertificate(publicCertificatePath) {
197197 * @private
198198 */
199199function getPrivateKey ( p12Path , alias , password ) {
200- let p12Content = fs . readFileSync ( p12Path , 'binary' ) ;
200+ const p12Content = fs . readFileSync ( p12Path , 'binary' ) ;
201201
202202 if ( ! p12Content || p12Content . length <= 1 ) {
203203 throw new Error ( 'p12 keystore content is empty' ) ;
@@ -212,13 +212,13 @@ function getPrivateKey(p12Path, alias, password) {
212212 }
213213
214214 // Get asn1 from DER
215- let p12Asn1 = forge . asn1 . fromDer ( p12Content , false ) ;
215+ const p12Asn1 = forge . asn1 . fromDer ( p12Content , false ) ;
216216
217217 // Get p12 using the password
218- let p12 = forge . pkcs12 . pkcs12FromAsn1 ( p12Asn1 , false , password ) ;
218+ const p12 = forge . pkcs12 . pkcs12FromAsn1 ( p12Asn1 , false , password ) ;
219219
220220 // Get Key from p12
221- let keyObj = p12 . getBags ( {
221+ const keyObj = p12 . getBags ( {
222222 friendlyName : alias ,
223223 bagType : forge . pki . oids . pkcs8ShroudedKeyBag
224224 } ) . friendlyName [ 0 ] ;
@@ -296,12 +296,12 @@ function createMessageDigest(digest) {
296296 * @private
297297 */
298298function isValidConfig ( config ) {
299- let propertiesBasic = [ "oaepPaddingDigestAlgorithm" , "dataEncoding" , "encryptionCertificate" , "encryptedValueFieldName" ] ;
300- let propertiesField = [ "ivFieldName" , "encryptedKeyFieldName" ] ;
301- let propertiesHeader = [ "ivHeaderName" , "encryptedKeyHeaderName" , "oaepHashingAlgorithmHeaderName" ] ;
302- let propertiesFingerprint = [ "publicKeyFingerprintType" , "publicKeyFingerprintFieldName" , "publicKeyFingerprintHeaderName" ] ;
303- let propertiesOptionalFingerprint = [ "publicKeyFingerprint" ] ;
304- let contains = ( props ) => {
299+ const propertiesBasic = [ "oaepPaddingDigestAlgorithm" , "dataEncoding" , "encryptionCertificate" , "encryptedValueFieldName" ] ;
300+ const propertiesField = [ "ivFieldName" , "encryptedKeyFieldName" ] ;
301+ const propertiesHeader = [ "ivHeaderName" , "encryptedKeyHeaderName" , "oaepHashingAlgorithmHeaderName" ] ;
302+ const propertiesFingerprint = [ "publicKeyFingerprintType" , "publicKeyFingerprintFieldName" , "publicKeyFingerprintHeaderName" ] ;
303+ const propertiesOptionalFingerprint = [ "publicKeyFingerprint" ] ;
304+ const contains = ( props ) => {
305305 return props . every ( ( elem ) => {
306306 return config [ elem ] !== null && typeof config [ elem ] !== "undefined" ;
307307 } ) ;
0 commit comments