codekingpro/portable-devtools
114k
1#2# This file is part of pyasn1-modules software.3#4# Created by Russ Housley with assistance from asn1ate v.0.6.0.5#6# Copyright (c) 2019, Vigil Security, LLC7# License: http://snmplabs.com/pyasn1/license.html8#9#The scrypt Password-Based Key Derivation Function10#11# ASN.1 source from:12# https://www.rfc-editor.org/rfc/rfc8520.txt13# https://www.rfc-editor.org/errata/eid587114#15 16from pyasn1.type import constraint17from pyasn1.type import namedtype18from pyasn1.type import univ19 20from pyasn1_modules import rfc528021 22MAX = float('inf')23 24 25id_scrypt = univ.ObjectIdentifier('1.3.6.1.4.1.11591.4.11')26 27 28class Scrypt_params(univ.Sequence):29 componentType = namedtype.NamedTypes(30 namedtype.NamedType('salt',31 univ.OctetString()),32 namedtype.NamedType('costParameter',33 univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),34 namedtype.NamedType('blockSize',35 univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),36 namedtype.NamedType('parallelizationParameter',37 univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, MAX))),38 namedtype.OptionalNamedType('keyLength',39 univ.Integer().subtype(subtypeSpec=constraint.ValueRangeConstraint(1, MAX)))40 )41 42 43# Update the Algorithm Identifier map in rfc5280.py44 45_algorithmIdentifierMapUpdate = {46 id_scrypt: Scrypt_params(),47}48 49rfc5280.algorithmIdentifierMap.update(_algorithmIdentifierMapUpdate)50 