pkixattributecertificate.erl
来自「OTP是开放电信平台的简称」· ERL 代码 · 共 1,806 行 · 第 1/4 页
ERL
1,806 行
%%================================%% Clearance_securityCategories%%================================'enc_Clearance_securityCategories'({'Clearance_securityCategories',Val}, TagIn) -> 'enc_Clearance_securityCategories'(Val, TagIn);'enc_Clearance_securityCategories'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_Clearance_securityCategories_components'(Val,[],0), ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'enc_Clearance_securityCategories_components'([], AccBytes, AccLen) -> {asn1rt_check:dynamicsort_SETOF(AccBytes),AccLen};'enc_Clearance_securityCategories_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_SecurityCategory'(H, [<<48>>]), 'enc_Clearance_securityCategories_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_Clearance_securityCategories'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), ['dec_SecurityCategory'(V1, [16]) || V1 <- Tlv1].'dec_Clearance'(Tlv) -> 'dec_Clearance'(Tlv, [16]).'dec_Clearance'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute policyId(1) with type OBJECT IDENTIFIER%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = ?RT_BER:decode_object_identifier(V1,[131072]),%%-------------------------------------------------%% attribute classList(2) with type BIT STRING DEFAULT = [unclassified]%%-------------------------------------------------{Term2,Tlv3} = case Tlv2 of[{131073,V2}|TempTlv3] -> {?RT_BER:decode_compact_bit_string(V2,[],[{unmarked,0},{unclassified,1},{restricted,2},{confidential,3},{secret,4},{topSecret,5}],[]), TempTlv3}; _ -> {[unclassified],Tlv2}end,%%-------------------------------------------------%% attribute securityCategories(3) with type SET OF OPTIONAL%%-------------------------------------------------{Term3,Tlv4} = case Tlv3 of[{131074,V3}|TempTlv4] -> {'dec_Clearance_securityCategories'(V3, []), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3}end,case Tlv4 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowedend, {'Clearance', Term1, Term2, Term3}.%%================================%% ClassList%%================================'enc_ClassList'(Val) -> 'enc_ClassList'(Val, [<<3>>]).'enc_ClassList'({'ClassList',Val}, TagIn) -> 'enc_ClassList'(Val, TagIn);'enc_ClassList'(Val, TagIn) ->?RT_BER:encode_bit_string([], Val, [{unmarked,0},{unclassified,1},{restricted,2},{confidential,3},{secret,4},{topSecret,5}], TagIn).'dec_ClassList'(Tlv) -> 'dec_ClassList'(Tlv, [3]).'dec_ClassList'(Tlv, TagIn) ->?RT_BER:decode_compact_bit_string(Tlv,[],[{unmarked,0},{unclassified,1},{restricted,2},{confidential,3},{secret,4},{topSecret,5}],TagIn).%%================================%% SecurityCategory%%================================'enc_SecurityCategory'(Val) -> 'enc_SecurityCategory'(Val, [<<48>>]).'enc_SecurityCategory'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,%%-------------------------------------------------%% attribute type(1) with type OBJECT IDENTIFIER%%------------------------------------------------- {EncBytes1,EncLen1} = ?RT_BER:encode_object_identifier(Cindex1, [<<128>>]),%%-------------------------------------------------%% attribute value(2) with type ASN1_OPEN_TYPE%%------------------------------------------------- {EncBytes2,EncLen2} = ?RT_BER:encode_open_type(Cindex2, [<<161>>]), BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_SecurityCategory'(Tlv) -> 'dec_SecurityCategory'(Tlv, [16]).'dec_SecurityCategory'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute type(1) with type OBJECT IDENTIFIER%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = ?RT_BER:decode_object_identifier(V1,[131072]),%%-------------------------------------------------%% attribute value(2) with type ASN1_OPEN_TYPE%%-------------------------------------------------[V2|Tlv3] = Tlv2, Term2 = ?RT_BER:decode_open_type_as_binary(V2,[131073]),case Tlv3 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowedend, {'SecurityCategory', Term1, Term2}.%%================================%% AAControls%%================================'enc_AAControls'(Val) -> 'enc_AAControls'(Val, [<<48>>]).'enc_AAControls'(Val, TagIn) ->{_,Cindex1, Cindex2, Cindex3, Cindex4} = Val,%%-------------------------------------------------%% attribute pathLenConstraint(1) with type INTEGER OPTIONAL%%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> ?RT_BER:encode_integer([], Cindex1, [<<2>>]) end,%%-------------------------------------------------%% attribute permittedAttrs(2) External PKIXAttributeCertificate:AttrSpec OPTIONAL%%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_AttrSpec'(Cindex2, [<<160>>]) end,%%-------------------------------------------------%% attribute excludedAttrs(3) External PKIXAttributeCertificate:AttrSpec OPTIONAL%%------------------------------------------------- {EncBytes3,EncLen3} = case Cindex3 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_AttrSpec'(Cindex3, [<<161>>]) end,%%-------------------------------------------------%% attribute permitUnSpecified(4) with type BOOLEAN DEFAULT = true%%------------------------------------------------- {EncBytes4,EncLen4} = case catch asn1rt_check:check_bool(true, Cindex4) of true -> {[],0}; _ -> ?RT_BER:encode_boolean(Cindex4, [<<1>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4],LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_AAControls'(Tlv) -> 'dec_AAControls'(Tlv, [16]).'dec_AAControls'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute pathLenConstraint(1) with type INTEGER OPTIONAL%%-------------------------------------------------{Term1,Tlv2} = case Tlv1 of[{2,V1}|TempTlv2] -> {?RT_BER:decode_integer(V1,{0,'MAX'},[]), TempTlv2}; _ -> { asn1_NOVALUE, Tlv1}end,%%-------------------------------------------------%% attribute permittedAttrs(2) External PKIXAttributeCertificate:AttrSpec OPTIONAL%%-------------------------------------------------{Term2,Tlv3} = case Tlv2 of[{131072,V2}|TempTlv3] -> {'dec_AttrSpec'(V2, []), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2}end,%%-------------------------------------------------%% attribute excludedAttrs(3) External PKIXAttributeCertificate:AttrSpec OPTIONAL%%-------------------------------------------------{Term3,Tlv4} = case Tlv3 of[{131073,V3}|TempTlv4] -> {'dec_AttrSpec'(V3, []), TempTlv4}; _ -> { asn1_NOVALUE, Tlv3}end,%%-------------------------------------------------%% attribute permitUnSpecified(4) with type BOOLEAN DEFAULT = true%%-------------------------------------------------{Term4,Tlv5} = case Tlv4 of[{1,V4}|TempTlv5] -> {?RT_BER:decode_boolean(V4,[]), TempTlv5}; _ -> {true,Tlv4}end,case Tlv5 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv5}}}) % extra fields not allowedend, {'AAControls', Term1, Term2, Term3, Term4}.%%================================%% AttrSpec%%================================'enc_AttrSpec'(Val) -> 'enc_AttrSpec'(Val, [<<48>>]).'enc_AttrSpec'({'AttrSpec',Val}, TagIn) -> 'enc_AttrSpec'(Val, TagIn);'enc_AttrSpec'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_AttrSpec_components'(Val,[],0), ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'enc_AttrSpec_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen};'enc_AttrSpec_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = ?RT_BER:encode_object_identifier(H, [<<6>>]), 'enc_AttrSpec_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_AttrSpec'(Tlv) -> 'dec_AttrSpec'(Tlv, [16]).'dec_AttrSpec'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), [?RT_BER:decode_object_identifier(V1,[6]) || V1 <- Tlv1].%%================================%% ACClearAttrs%%================================'enc_ACClearAttrs'(Val) -> 'enc_ACClearAttrs'(Val, [<<48>>]).'enc_ACClearAttrs'(Val, TagIn) ->{_,Cindex1, Cindex2, Cindex3} = Val,%%-------------------------------------------------%% attribute acIssuer(1) External PKIX1Implicit88:GeneralName%%------------------------------------------------- {EncBytes1,EncLen1} = 'PKIX1Implicit88':'enc_GeneralName'(Cindex1, []),%%-------------------------------------------------%% attribute acSerial(2) with type INTEGER%%------------------------------------------------- {EncBytes2,EncLen2} = ?RT_BER:encode_integer([], Cindex2, [<<2>>]),%%-------------------------------------------------%% attribute attrs(3) with type SEQUENCE OF%%------------------------------------------------- {EncBytes3,EncLen3} = 'enc_ACClearAttrs_attrs'(Cindex3, [<<48>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],LenSoFar = EncLen1 + EncLen2 + EncLen3,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).%%================================%% ACClearAttrs_attrs%%================================'enc_ACClearAttrs_attrs'({'ACClearAttrs_attrs',Val}, TagIn) -> 'enc_ACClearAttrs_attrs'(Val, TagIn);'enc_ACClearAttrs_attrs'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_ACClearAttrs_attrs_components'(Val,[],0), ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'enc_ACClearAttrs_attrs_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen};'enc_ACClearAttrs_attrs_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'PKIX1Explicit88':'enc_Attribute'(H, [<<48>>]), 'enc_ACClearAttrs_attrs_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_ACClearAttrs_attrs'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), ['PKIX1Explicit88':'dec_Attribute'(V1, [16]) || V1 <- Tlv1].'dec_ACClearAttrs'(Tlv) -> 'dec_ACClearAttrs'(Tlv, [16]).'dec_ACClearAttrs'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute acIssuer(1) External PKIX1Implicit88:GeneralName%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = 'PKIX1Implicit88':'dec_GeneralName'(V1, []),%%-------------------------------------------------%% attribute acSerial(2) with type INTEGER%%-------------------------------------------------[V2|Tlv3] = Tlv2, Term2 = ?RT_BER:decode_integer(V2,[],[2]),%%-------------------------------------------------%% attribute attrs(3) with type SEQUENCE OF%%-------------------------------------------------[V3|Tlv4] = Tlv3, Term3 = 'dec_ACClearAttrs_attrs'(V3, [16]),case Tlv4 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowedend, {'ACClearAttrs', Term1, Term2, Term3}.%%================================%% ProxyInfo%%================================'enc_ProxyInfo'(Val) -> 'enc_ProxyInfo'(Val, [<<48>>]).'enc_ProxyInfo'({'ProxyInfo',Val}, TagIn) -> 'enc_ProxyInfo'(Val, TagIn);'enc_ProxyInfo'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_ProxyInfo_components'(Val,[],0), ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'enc_ProxyInfo_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen};'enc_ProxyInfo_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_Targets'(H, [<<48>>]), 'enc_ProxyInfo_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_ProxyInfo'(Tlv) -> 'dec_ProxyInfo'(Tlv, [16]).'dec_ProxyInfo'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), ['dec_Targets'(V1, [16]) || V1 <- Tlv1].'id-pe-ac-auditIdentity'() ->{1,3,6,1,5,5,7,1,4}.'id-pe-aaControls'() ->{1,3,6,1,5,5,7,1,6}.'id-pe-ac-proxying'() ->{1,3,6,1,5,5,7,1,10}.'id-ce-targetInformation'() ->{2,5,29,55}.'id-aca'() ->{1,3,6,1,5,5,7,10}.'id-aca-authenticationInfo'() ->{1,3,6,1,5,5,7,10,1}.'id-aca-accessIdentity'() ->{1,3,6,1,5,5,7,10,2}.'id-aca-chargingIdentity'() ->{1,3,6,1,5,5,7,10,3}.'id-aca-group'() ->{1,3,6,1,5,5,7,10,4}.'id-aca-encAttrs'() ->{1,3,6,1,5,5,7,10,6}.'id-at-role'() ->{2,5,4,72}.'id-at-clearance'() ->{2,5,1,5,55}.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?