'history': 'ChangeLog.txt',
'tests': 'Tests',
'licenses': 'Licenses',
- 'digest': 'sha256',
+ 'digest': 'sha-256',
'certificate': None,
'privkey': None,
}
'history': 'ChangeLog.txt',
'tests': 'Tests',
'licenses': 'Licenses',
- 'digest': 'sha256',
+ 'digest': 'sha-256',
'certificate': 'test.crt',
'privkey': os.path.join(ROOT_DIR, 'tests', 'resources', 'signature', 'test.key')
}
'history': None,
'tests': None,
'licenses': None,
- 'digest': 'sha256',
+ 'digest': 'sha-256',
'certificate': None,
'privkey': None,
}
FILE_CONTENT = "needToBeHashed"
FILE_DIGEST = '\n'.join(['Source: digest',
- 'Algorithm: SHA256',
+ 'Algorithm: SHA-256',
'Hash: 20a480339aa4371099f9503511dcc5a8051ce3884846678ced5611ec64bbfc9c',
])
digest.write(FILE_CONTENT)
m = manifest.Manifest(mf.dirname, 'test.mf')
- assert m.digests['digest'][0] == "SHA256"
+ assert m.digests['digest'][0] == "SHA-256"
assert m.digests['digest'][1] == "20a480339aa4371099f9503511dcc5a8051ce3884846678ced5611ec64bbfc9c"
def test_add_file(tmpdir):
digest.write(FILE_CONTENT)
m = manifest.Manifest(mf.dirname, 'test.mf')
- m.add_file('digest', 'SHA256')
- assert m.digests['digest'][0] == "SHA256"
+ m.add_file('digest', 'SHA-256')
+ assert m.digests['digest'][0] == "SHA-256"
assert m.digests['digest'][1] == "20a480339aa4371099f9503511dcc5a8051ce3884846678ced5611ec64bbfc9c"
def test_update_to_file(tmpdir):
digest2.write(FILE_CONTENT)
m1 = manifest.Manifest(mf.dirname, 'test.mf')
- m1.add_file('digest2', 'SHA256')
+ m1.add_file('digest2', 'SHA-256')
m1.signature = CMS
m1.update_to_file()
m2 = manifest.Manifest(mf.dirname, 'test.mf')
import pkg_resources
from vnfsdk_pkgtools.packager import csar
+from vnfsdk_pkgtools.packager import manifest
from vnfsdk_pkgtools import validator
from vnfsdk_pkgtools import vnfreq
help='Directory containing license information, relative to service template directory')
csar_create.add_argument(
'--digest',
- choices=['SHA256', 'SHA512'],
+ choices=manifest.SUPPORTED_HASH_ALGO,
help='If present, means to check the file deigest in manifest; compute the digest using the specified hash algorithm of all files in the csar package to be put into the manifest file')
csar_create.add_argument(
'--certificate',
'vnf_release_data_time',
'vnf_package_version']
DIGEST_KEYS = [ 'Source', 'Algorithm', 'Hash' ]
-SUPPORTED_HASH_ALGO = ['SHA256', 'SHA512']
+SUPPORTED_HASH_ALGO = ['SHA-256', 'SHA-512']
class ManifestException(Exception):
pass