⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ssl-pkix.erl

📁 OTP是开放电信平台的简称
💻 ERL
📖 第 1 页 / 共 5 页
字号:
   {EncBytes5,EncLen5} = 'PKIX1Explicit88':'enc_Validity'(Cindex5, [<<48>>]),%%-------------------------------------------------%% attribute subject(6)   External PKIX1Explicit88:Name%%-------------------------------------------------   {EncBytes6,EncLen6} = 'PKIX1Explicit88':'enc_Name'(Cindex6, []),%%-------------------------------------------------%% attribute subjectPublicKeyInfo(7)   External SSL-PKIX:SubjectPublicKeyInfo%%-------------------------------------------------   {EncBytes7,EncLen7} = 'enc_SubjectPublicKeyInfo'(Cindex7, [<<48>>]),%%-------------------------------------------------%% attribute issuerUniqueID(8) with type BIT STRING OPTIONAL%%-------------------------------------------------   {EncBytes8,EncLen8} =  case Cindex8 of         asn1_NOVALUE -> {<<>>,0};         _ ->            ?RT_BER:encode_bit_string([], Cindex8, [], [<<129>>])       end,%%-------------------------------------------------%% attribute subjectUniqueID(9) with type BIT STRING OPTIONAL%%-------------------------------------------------   {EncBytes9,EncLen9} =  case Cindex9 of         asn1_NOVALUE -> {<<>>,0};         _ ->            ?RT_BER:encode_bit_string([], Cindex9, [], [<<130>>])       end,%%-------------------------------------------------%% attribute extensions(10)   External SSL-PKIX:Extensions OPTIONAL%%-------------------------------------------------   {EncBytes10,EncLen10} =  case Cindex10 of         asn1_NOVALUE -> {<<>>,0};         _ ->            'enc_Extensions'(Cindex10, [<<48>>,<<163>>])       end,   BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9, EncBytes10],LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9 + EncLen10,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_TBSCertificate'(Tlv) ->   'dec_TBSCertificate'(Tlv, [16]).'dec_TBSCertificate'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute version(1) with type INTEGER DEFAULT = 0%%-------------------------------------------------{Term1,Tlv2} = case Tlv1 of[{131072,V1}|TempTlv2] ->    {?RT_BER:decode_integer(V1,[],[{v1,0},{v2,1},{v3,2}],[2]), TempTlv2};    _ ->        {0,Tlv1}end,%%-------------------------------------------------%% attribute serialNumber(2) with type INTEGER%%-------------------------------------------------[V2|Tlv3] = Tlv2, Term2 = ?RT_BER:decode_integer(V2,[],[2]),%%-------------------------------------------------%% attribute signature(3)   External SSL-PKIX:SignatureAlgorithm%%-------------------------------------------------[V3|Tlv4] = Tlv3, Term3 = 'dec_SignatureAlgorithm'(V3, [16]),%%-------------------------------------------------%% attribute issuer(4)   External PKIX1Explicit88:Name%%-------------------------------------------------[V4|Tlv5] = Tlv4, Term4 = 'PKIX1Explicit88':'dec_Name'(V4, []),%%-------------------------------------------------%% attribute validity(5)   External PKIX1Explicit88:Validity%%-------------------------------------------------[V5|Tlv6] = Tlv5, Term5 = 'PKIX1Explicit88':'dec_Validity'(V5, [16]),%%-------------------------------------------------%% attribute subject(6)   External PKIX1Explicit88:Name%%-------------------------------------------------[V6|Tlv7] = Tlv6, Term6 = 'PKIX1Explicit88':'dec_Name'(V6, []),%%-------------------------------------------------%% attribute subjectPublicKeyInfo(7)   External SSL-PKIX:SubjectPublicKeyInfo%%-------------------------------------------------[V7|Tlv8] = Tlv7, Term7 = 'dec_SubjectPublicKeyInfo'(V7, [16]),%%-------------------------------------------------%% attribute issuerUniqueID(8) with type BIT STRING OPTIONAL%%-------------------------------------------------{Term8,Tlv9} = case Tlv8 of[{131073,V8}|TempTlv9] ->    {?RT_BER:decode_compact_bit_string(V8,[],[],[]), TempTlv9};    _ ->        { asn1_NOVALUE, Tlv8}end,%%-------------------------------------------------%% attribute subjectUniqueID(9) with type BIT STRING OPTIONAL%%-------------------------------------------------{Term9,Tlv10} = case Tlv9 of[{131074,V9}|TempTlv10] ->    {?RT_BER:decode_compact_bit_string(V9,[],[],[]), TempTlv10};    _ ->        { asn1_NOVALUE, Tlv9}end,%%-------------------------------------------------%% attribute extensions(10)   External SSL-PKIX:Extensions OPTIONAL%%-------------------------------------------------{Term10,Tlv11} = case Tlv10 of[{131075,V10}|TempTlv11] ->    {'dec_Extensions'(V10, [16]), TempTlv11};    _ ->        { asn1_NOVALUE, Tlv10}end,case Tlv11 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv11}}}) % extra fields not allowedend,   {'TBSCertificate', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9, Term10}.%%================================%%  AttributeTypeAndValue%%================================'enc_AttributeTypeAndValue'(Val) ->    'enc_AttributeTypeAndValue'(Val, [<<48>>]).'enc_AttributeTypeAndValue'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,Objtype =    'getenc_SupportedAttributeTypeAndValues'(id,                                    Cindex1),%%-------------------------------------------------%% attribute type(1) with type fixedtypevaluefieldidtypetagUNIVERSAL6IMPLICIT0OBJECT IDENTIFIERno%%-------------------------------------------------   {EncBytes1,EncLen1} = ?RT_BER:encode_object_identifier(Cindex1, [<<6>>]),%%-------------------------------------------------%% attribute value(2) with type typefieldType%%-------------------------------------------------   {TmpBytes1,_} = Objtype('Type', Cindex2, []),   {EncBytes2,EncLen2} = ?RT_BER:encode_open_type(TmpBytes1,[]),   BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_AttributeTypeAndValue'(Tlv) ->   'dec_AttributeTypeAndValue'(Tlv, [16]).'dec_AttributeTypeAndValue'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute type(1) with type fixedtypevaluefieldidtypetagUNIVERSAL6IMPLICIT0OBJECT IDENTIFIERno%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = ?RT_BER:decode_object_identifier(V1,[6]),%%-------------------------------------------------%% attribute value(2) with type typefieldType%%-------------------------------------------------[V2|Tlv3] = Tlv2,   Tmpterm1 = ?RT_BER:decode_open_type(V2,[]),DecObjtypeTerm1 =   'getdec_SupportedAttributeTypeAndValues'(id, Term1),Term2 =    case (catch DecObjtypeTerm1('Type', Tmpterm1, [])) of      {'EXIT', Reason1} ->         exit({'Type not compatible with table constraint',Reason1});      Tmpterm2 ->         Tmpterm2   end,case Tlv3 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowedend,   {'AttributeTypeAndValue', Term1, Term2}.%%================================%%  SubjectPublicKeyInfo%%================================'enc_SubjectPublicKeyInfo'(Val) ->    'enc_SubjectPublicKeyInfo'(Val, [<<48>>]).'enc_SubjectPublicKeyInfo'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,Objalgorithm =    'getenc_SupportedPublicKeyAlgorithms'(id,                                    element(2,Cindex1)),%%-------------------------------------------------%% attribute algorithm(1) with type SEQUENCE%%-------------------------------------------------   {EncBytes1,EncLen1} = 'enc_SubjectPublicKeyInfo_algorithm'(Cindex1, [<<48>>]),%%-------------------------------------------------%% attribute subjectPublicKey(2) with type typefieldPublicKeyType%%-------------------------------------------------   {TmpBytes1,_} = Objalgorithm('PublicKeyType', Cindex2, []),   {EncBytes2,EncLen2} = ?RT_BER:encode_open_type(TmpBytes1,[]),   BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).%%================================%%  SubjectPublicKeyInfo_algorithm%%================================'enc_SubjectPublicKeyInfo_algorithm'(Val, TagIn) ->   {_,Cindex1, Cindex2} = Val,Objalgo =    'getenc_SupportedPublicKeyAlgorithms'(id,                                    Cindex1),%%-------------------------------------------------%% attribute algo(1) with type fixedtypevaluefieldidtypetagUNIVERSAL6IMPLICIT0OBJECT IDENTIFIERno%%-------------------------------------------------   {EncBytes1,EncLen1} = ?RT_BER:encode_object_identifier(Cindex1, [<<6>>]),%%-------------------------------------------------%% attribute parameters(2) with type typefieldType OPTIONAL%%-------------------------------------------------   {EncBytes2,EncLen2} =  case Cindex2 of         asn1_NOVALUE -> {<<>>,0};         _ ->            {TmpBytes,_ } = Objalgo('Type', Cindex2, []),   {TmpBytes1,TmpLen} = ?RT_BER:encode_open_type(TmpBytes,[]),   {TmpBytes1, TmpLen}       end,   BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_SubjectPublicKeyInfo_algorithm'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute algo(1) with type fixedtypevaluefieldidtypetagUNIVERSAL6IMPLICIT0OBJECT IDENTIFIERno%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = ?RT_BER:decode_object_identifier(V1,[6]),%%-------------------------------------------------%% attribute parameters(2) with type typefieldType OPTIONAL%%-------------------------------------------------{Tmpterm1,Tlv3} = case Tlv2 of[V2|TempTlv3] ->    {?RT_BER:decode_open_type(V2,[]), TempTlv3};    _ ->        { asn1_NOVALUE, Tlv2}end,DecObjalgoTerm1 =   'getdec_SupportedPublicKeyAlgorithms'(id, Term1),Term2 =    case Tmpterm1 of      asn1_NOVALUE ->asn1_NOVALUE;      _ ->         case (catch DecObjalgoTerm1('Type', Tmpterm1, [])) of            {'EXIT', Reason1} ->               exit({'Type not compatible with table constraint',Reason1});            Tmpterm2 ->               Tmpterm2         end   end,case Tlv3 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowedend,   {'SubjectPublicKeyInfo_algorithm', Term1, Term2}.'dec_SubjectPublicKeyInfo'(Tlv) ->   'dec_SubjectPublicKeyInfo'(Tlv, [16]).'dec_SubjectPublicKeyInfo'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute algorithm(1) with type SEQUENCE%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = 'dec_SubjectPublicKeyInfo_algorithm'(V1, [16]),%%-------------------------------------------------%% attribute subjectPublicKey(2) with type typefieldPublicKeyType%%-------------------------------------------------[V2|Tlv3] = Tlv2,   Tmpterm1 = ?RT_BER:decode_open_type(V2,[]),DecObjalgorithmTerm1 =   'getdec_SupportedPublicKeyAlgorithms'(id, element(2,Term1)),Term2 =    case (catch DecObjalgorithmTerm1('PublicKeyType', Tmpterm1, [])) of      {'EXIT', Reason1} ->         exit({'Type not compatible with table constraint',Reason1});      Tmpterm2 ->         Tmpterm2   end,case Tlv3 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowedend,   {'SubjectPublicKeyInfo', Term1, Term2}.%%================================%%  SubjectPublicKeyInfo-Any%%================================'enc_SubjectPublicKeyInfo-Any'(Val) ->    'enc_SubjectPublicKeyInfo-Any'(Val, [<<48>>]).'enc_SubjectPublicKeyInfo-Any'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,%%-------------------------------------------------%% attribute algorithm(1)   External SSL-PKIX:PublicKeyAlgorithm%%-------------------------------------------------   {EncBytes1,EncLen1} = 'enc_PublicKeyAlgorithm'(Cindex1, [<<48>>]),%%-------------------------------------------------%% attribute subjectPublicKey(2) with type ASN1_OPEN_TYPE%%-------------------------------------------------   {EncBytes2,EncLen2} = ?RT_BER:encode_open_type(Cindex2, []),   BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_SubjectPublicKeyInfo-Any'(Tlv) ->   'dec_SubjectPublicKeyInfo-Any'(Tlv, [16]).'dec_SubjectPublicKeyInfo-Any'(Tlv, TagIn) ->   %%-------------------------------------------------   %% decode tag and length    %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute algorithm(1)   External SSL-PKIX:PublicKeyAlgorithm%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = 'dec_PublicKeyAlgorithm'(V1, [16]),%%-------------------------------------------------%% attribute subjectPublicKey(2) with type ASN1_OPEN_TYPE%%-------------------------------------------------[V2|Tlv3] = Tlv2, Term2 = ?RT_BER:decode_open_type_as_binary(V2,[]),case Tlv3 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowedend,   {'SubjectPublicKeyInfo-Any', Term1, Term2}.%%================================%%  SignatureAlgorithm%%================================'enc_SignatureAlgorithm'(Val) ->    'enc_SignatureAlgorithm'(Val, [<<48>>]).'enc_SignatureAlgorithm'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,Objalgorithm =    'getenc_SupportedSignatureAlgorithms'(id,                                    Cindex1),%%-------------------------------------------------%% attribute algorithm(1) with type fixedtypevaluefieldidtypetagUNIVERSAL6IMPLICIT0OBJECT IDENTIFIERno%%-------------------------------------------------   {EncBytes1,EncLen1} = ?RT_BER:encode_object_identifier(Cindex1, [<<6>>]),%%-------------------------------------------------%% attribute parameters(2) with type typefieldType OPTIONAL%%-------------------------------------------------   {EncBytes2,EncLen2} =  case Cindex2 of         asn1_NOVALUE -> {<<>>,0};         _ ->            {TmpBytes,_ } = Objalgorithm('Type', Cindex2, []),   {TmpBytes1,TmpLen} = ?RT_BER:encode_open_type(TmpBytes,[]),   {TmpBytes1, TmpLen}       end,   BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_SignatureAlgorithm'(Tlv) ->   'dec_SignatureAlgorithm'(Tlv, [16]).'dec_SignatureAlgorithm'(Tlv, TagIn) ->

⌨️ 快捷键说明

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