/*
* Copyright 2018 Scytl Secure Electronic Voting SA
*
* All rights reserved
*
* See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
*/
/* jshint node:true */
'use strict';
module.exports = KeyUsageExtension;
/**
* @class KeyUsageExtension
* @classdesc Encapsulates the key usage extension flags of an X.509
* certificate. This object is instantiated internally by the method
* {@link CertificateService.newX509Certificate} and made available
* as a property of the returned {@link X509Certificate} object.
* @property {boolean} digitalSignature true
if the
* digital signature
flag is set, false
* otherwise.
* @property {boolean} nonRepudiation true
if the
* non-repudiation
flag is set, false
* otherwise.
* @property {boolean} keyEncipherment true
if the
* key encipherment
flag is set, false
* otherwise.
* @property {boolean} dataEncipherment true
if the
* data encipherment
flag is set, false
* otherwise.
* @property {boolean} keyAgreement true
if the
* key agreement
flag is set, false
* otherwise.
* @property {boolean} keyCertSign true
if the
* key certificate sign
flag is set, false
* otherwise.
* @property {boolean} crlSign true
if the CRL sign
* flag is set, false
otherwise.
* @property {boolean} encipherOnly true
if the
* encipher only
flag is set, false
* otherwise.
* @property {boolean} decipherOnly true
if the
* decipher only
flag is set, false
* otherwise.
*/
function KeyUsageExtension(extension) {
return Object.freeze({
digitalSignature: extension.digitalSignature,
nonRepudiation: extension.nonRepudiation,
keyEncipherment: extension.keyEncipherment,
dataEncipherment: extension.dataEncipherment,
keyAgreement: extension.keyAgreement,
keyCertSign: extension.keyCertSign,
crlSign: extension.cRLSign,
encipherOnly: extension.encipherOnly,
decipherOnly: extension.decipherOnly
});
}