pkix1implicit88.erl

来自「OTP是开放电信平台的简称」· ERL 代码 · 共 2,076 行 · 第 1/5 页

ERL
2,076
字号
'enc_PolicyConstraints'(Val) ->    'enc_PolicyConstraints'(Val, [<<48>>]).'enc_PolicyConstraints'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,%%-------------------------------------------------%% attribute requireExplicitPolicy(1) with type INTEGER OPTIONAL%%-------------------------------------------------   {EncBytes1,EncLen1} =  case Cindex1 of         asn1_NOVALUE -> {<<>>,0};         _ ->            ?RT_BER:encode_integer([], Cindex1, [<<128>>])       end,%%-------------------------------------------------%% attribute inhibitPolicyMapping(2) with type INTEGER OPTIONAL%%-------------------------------------------------   {EncBytes2,EncLen2} =  case Cindex2 of         asn1_NOVALUE -> {<<>>,0};         _ ->            ?RT_BER:encode_integer([], Cindex2, [<<129>>])       end,   BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_PolicyConstraints'(Tlv) ->   'dec_PolicyConstraints'(Tlv, [16]).'dec_PolicyConstraints'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute requireExplicitPolicy(1) with type INTEGER OPTIONAL%%-------------------------------------------------{Term1,Tlv2} = case Tlv1 of[{131072,V1}|TempTlv2] ->    {?RT_BER:decode_integer(V1,{0,'MAX'},[]), TempTlv2};    _ ->        { asn1_NOVALUE, Tlv1}end,%%-------------------------------------------------%% attribute inhibitPolicyMapping(2) with type INTEGER OPTIONAL%%-------------------------------------------------{Term2,Tlv3} = case Tlv2 of[{131073,V2}|TempTlv3] ->    {?RT_BER:decode_integer(V2,{0,'MAX'},[]), TempTlv3};    _ ->        { asn1_NOVALUE, Tlv2}end,case Tlv3 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowedend,   {'PolicyConstraints', Term1, Term2}.%%================================%%  SkipCerts%%================================'enc_SkipCerts'(Val) ->    'enc_SkipCerts'(Val, [<<2>>]).'enc_SkipCerts'({'SkipCerts',Val}, TagIn) ->   'enc_SkipCerts'(Val, TagIn);'enc_SkipCerts'(Val, TagIn) ->?RT_BER:encode_integer([], Val, TagIn).'dec_SkipCerts'(Tlv) ->   'dec_SkipCerts'(Tlv, [2]).'dec_SkipCerts'(Tlv, TagIn) ->?RT_BER:decode_integer(Tlv,{0,'MAX'},TagIn).%%================================%%  CRLDistributionPoints%%================================'enc_CRLDistributionPoints'(Val) ->    'enc_CRLDistributionPoints'(Val, [<<48>>]).'enc_CRLDistributionPoints'({'CRLDistributionPoints',Val}, TagIn) ->   'enc_CRLDistributionPoints'(Val, TagIn);'enc_CRLDistributionPoints'(Val, TagIn) ->   {EncBytes,EncLen} = 'enc_CRLDistributionPoints_components'(Val,[],0),   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'enc_CRLDistributionPoints_components'([], AccBytes, AccLen) ->    {lists:reverse(AccBytes),AccLen};'enc_CRLDistributionPoints_components'([H|T],AccBytes, AccLen) ->   {EncBytes,EncLen} = 'enc_DistributionPoint'(H, [<<48>>]),   'enc_CRLDistributionPoints_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_CRLDistributionPoints'(Tlv) ->   'dec_CRLDistributionPoints'(Tlv, [16]).'dec_CRLDistributionPoints'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), ['dec_DistributionPoint'(V1, [16]) || V1 <- Tlv1].%%================================%%  DistributionPoint%%================================'enc_DistributionPoint'(Val) ->    'enc_DistributionPoint'(Val, [<<48>>]).'enc_DistributionPoint'(Val, TagIn) ->{_,Cindex1, Cindex2, Cindex3} = Val,%%-------------------------------------------------%% attribute distributionPoint(1)   External PKIX1Implicit88:DistributionPointName OPTIONAL%%-------------------------------------------------   {EncBytes1,EncLen1} =  case Cindex1 of         asn1_NOVALUE -> {<<>>,0};         _ ->            'enc_DistributionPointName'(Cindex1, [<<160>>])       end,%%-------------------------------------------------%% attribute reasons(2) with type BIT STRING OPTIONAL%%-------------------------------------------------   {EncBytes2,EncLen2} =  case Cindex2 of         asn1_NOVALUE -> {<<>>,0};         _ ->            ?RT_BER:encode_bit_string([], Cindex2, [{unused,0},{keyCompromise,1},{cACompromise,2},{affiliationChanged,3},{superseded,4},{cessationOfOperation,5},{certificateHold,6},{privilegeWithdrawn,7},{aACompromise,8}], [<<129>>])       end,%%-------------------------------------------------%% attribute cRLIssuer(3)   External PKIX1Implicit88:GeneralNames OPTIONAL%%-------------------------------------------------   {EncBytes3,EncLen3} =  case Cindex3 of         asn1_NOVALUE -> {<<>>,0};         _ ->            'enc_GeneralNames'(Cindex3, [<<162>>])       end,   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],LenSoFar = EncLen1 + EncLen2 + EncLen3,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_DistributionPoint'(Tlv) ->   'dec_DistributionPoint'(Tlv, [16]).'dec_DistributionPoint'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute distributionPoint(1)   External PKIX1Implicit88:DistributionPointName OPTIONAL%%-------------------------------------------------{Term1,Tlv2} = case Tlv1 of[{131072,V1}|TempTlv2] ->    {'dec_DistributionPointName'(V1, []), TempTlv2};    _ ->        { asn1_NOVALUE, Tlv1}end,%%-------------------------------------------------%% attribute reasons(2) with type BIT STRING OPTIONAL%%-------------------------------------------------{Term2,Tlv3} = case Tlv2 of[{131073,V2}|TempTlv3] ->    {?RT_BER:decode_compact_bit_string(V2,[],[{unused,0},{keyCompromise,1},{cACompromise,2},{affiliationChanged,3},{superseded,4},{cessationOfOperation,5},{certificateHold,6},{privilegeWithdrawn,7},{aACompromise,8}],[]), TempTlv3};    _ ->        { asn1_NOVALUE, Tlv2}end,%%-------------------------------------------------%% attribute cRLIssuer(3)   External PKIX1Implicit88:GeneralNames OPTIONAL%%-------------------------------------------------{Term3,Tlv4} = case Tlv3 of[{131074,V3}|TempTlv4] ->    {'dec_GeneralNames'(V3, []), TempTlv4};    _ ->        { asn1_NOVALUE, Tlv3}end,case Tlv4 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowedend,   {'DistributionPoint', Term1, Term2, Term3}.%%================================%%  DistributionPointName%%================================'enc_DistributionPointName'(Val) ->    'enc_DistributionPointName'(Val, []).'enc_DistributionPointName'({'DistributionPointName',Val}, TagIn) ->   'enc_DistributionPointName'(Val, TagIn);'enc_DistributionPointName'(Val, TagIn) ->   {EncBytes,EncLen} = case element(1,Val) of      fullName ->         'enc_GeneralNames'(element(2,Val), [<<160>>]);      nameRelativeToCRLIssuer ->         'PKIX1Explicit88':'enc_RelativeDistinguishedName'(element(2,Val), [<<161>>]);      Else ->          exit({error,{asn1,{invalid_choice_type,Else}}})   end,?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'dec_DistributionPointName'(Tlv) ->   'dec_DistributionPointName'(Tlv, []).'dec_DistributionPointName'(Tlv, TagIn) ->Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), case (case Tlv1 of [CtempTlv1] -> CtempTlv1; _ -> Tlv1 end) of%% 'fullName'    {131072, V1} ->         {fullName, 'dec_GeneralNames'(V1, [])};%% 'nameRelativeToCRLIssuer'    {131073, V1} ->         {nameRelativeToCRLIssuer, 'PKIX1Explicit88':'dec_RelativeDistinguishedName'(V1, [])};      Else ->          exit({error,{asn1,{invalid_choice_tag,Else}}})   end.%%================================%%  ReasonFlags%%================================'enc_ReasonFlags'(Val) ->    'enc_ReasonFlags'(Val, [<<3>>]).'enc_ReasonFlags'({'ReasonFlags',Val}, TagIn) ->   'enc_ReasonFlags'(Val, TagIn);'enc_ReasonFlags'(Val, TagIn) ->?RT_BER:encode_bit_string([], Val, [{unused,0},{keyCompromise,1},{cACompromise,2},{affiliationChanged,3},{superseded,4},{cessationOfOperation,5},{certificateHold,6},{privilegeWithdrawn,7},{aACompromise,8}], TagIn).'dec_ReasonFlags'(Tlv) ->   'dec_ReasonFlags'(Tlv, [3]).'dec_ReasonFlags'(Tlv, TagIn) ->?RT_BER:decode_compact_bit_string(Tlv,[],[{unused,0},{keyCompromise,1},{cACompromise,2},{affiliationChanged,3},{superseded,4},{cessationOfOperation,5},{certificateHold,6},{privilegeWithdrawn,7},{aACompromise,8}],TagIn).%%================================%%  ExtKeyUsageSyntax%%================================'enc_ExtKeyUsageSyntax'(Val) ->    'enc_ExtKeyUsageSyntax'(Val, [<<48>>]).'enc_ExtKeyUsageSyntax'({'ExtKeyUsageSyntax',Val}, TagIn) ->   'enc_ExtKeyUsageSyntax'(Val, TagIn);'enc_ExtKeyUsageSyntax'(Val, TagIn) ->   {EncBytes,EncLen} = 'enc_ExtKeyUsageSyntax_components'(Val,[],0),   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'enc_ExtKeyUsageSyntax_components'([], AccBytes, AccLen) ->    {lists:reverse(AccBytes),AccLen};'enc_ExtKeyUsageSyntax_components'([H|T],AccBytes, AccLen) ->   {EncBytes,EncLen} = ?RT_BER:encode_object_identifier(H, [<<6>>]),   'enc_ExtKeyUsageSyntax_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_ExtKeyUsageSyntax'(Tlv) ->   'dec_ExtKeyUsageSyntax'(Tlv, [16]).'dec_ExtKeyUsageSyntax'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), [?RT_BER:decode_object_identifier(V1,[6]) || V1 <- Tlv1].%%================================%%  KeyPurposeId%%================================'enc_KeyPurposeId'(Val) ->    'enc_KeyPurposeId'(Val, [<<6>>]).'enc_KeyPurposeId'({'KeyPurposeId',Val}, TagIn) ->   'enc_KeyPurposeId'(Val, TagIn);'enc_KeyPurposeId'(Val, TagIn) ->?RT_BER:encode_object_identifier(Val, TagIn).'dec_KeyPurposeId'(Tlv) ->   'dec_KeyPurposeId'(Tlv, [6]).'dec_KeyPurposeId'(Tlv, TagIn) ->?RT_BER:decode_object_identifier(Tlv,TagIn).%%================================%%  InhibitAnyPolicy%%================================'enc_InhibitAnyPolicy'(Val) ->    'enc_InhibitAnyPolicy'(Val, [<<2>>]).'enc_InhibitAnyPolicy'({'InhibitAnyPolicy',Val}, TagIn) ->   'enc_InhibitAnyPolicy'(Val, TagIn);'enc_InhibitAnyPolicy'(Val, TagIn) ->?RT_BER:encode_integer([], Val, TagIn).'dec_InhibitAnyPolicy'(Tlv) ->   'dec_InhibitAnyPolicy'(Tlv, [2]).'dec_InhibitAnyPolicy'(Tlv, TagIn) ->?RT_BER:decode_integer(Tlv,{0,'MAX'},TagIn).%%================================%%  FreshestCRL%%================================'enc_FreshestCRL'(Val) ->    'enc_FreshestCRL'(Val, [<<48>>]).'enc_FreshestCRL'({'FreshestCRL',Val}, TagIn) ->   'enc_FreshestCRL'(Val, TagIn);'enc_FreshestCRL'(Val, TagIn) ->   'enc_CRLDistributionPoints'(Val, TagIn).'dec_FreshestCRL'(Tlv) ->   'dec_FreshestCRL'(Tlv, [16]).'dec_FreshestCRL'(Tlv, TagIn) ->'dec_CRLDistributionPoints'(Tlv, TagIn).%%================================%%  AuthorityInfoAccessSyntax%%================================'enc_AuthorityInfoAccessSyntax'(Val) ->    'enc_AuthorityInfoAccessSyntax'(Val, [<<48>>]).'enc_AuthorityInfoAccessSyntax'({'AuthorityInfoAccessSyntax',Val}, TagIn) ->   'enc_AuthorityInfoAccessSyntax'(Val, TagIn);'enc_AuthorityInfoAccessSyntax'(Val, TagIn) ->   {EncBytes,EncLen} = 'enc_AuthorityInfoAccessSyntax_components'(Val,[],0),   ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'enc_AuthorityInfoAccessSyntax_components'([], AccBytes, AccLen) ->    {lists:reverse(AccBytes),AccLen};'enc_AuthorityInfoAccessSyntax_components'([H|T],AccBytes, AccLen) ->   {EncBytes,EncLen} = 'enc_AccessDescription'(H, [<<48>>]),   'enc_AuthorityInfoAccessSyntax_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_AuthorityInfoAccessSyntax'(Tlv) ->   'dec_AuthorityInfoAccessSyntax'(Tlv, [16]).'dec_AuthorityInfoAccessSyntax'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?