📄 ssl-pkix.erl
字号:
%%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute algorithm(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,DecObjalgorithmTerm1 = 'getdec_SupportedSignatureAlgorithms'(id, Term1),Term2 = case Tmpterm1 of asn1_NOVALUE ->asn1_NOVALUE; _ -> case (catch DecObjalgorithmTerm1('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, {'SignatureAlgorithm', Term1, Term2}.%%================================%% SignatureAlgorithm-Any%%================================'enc_SignatureAlgorithm-Any'(Val) -> 'enc_SignatureAlgorithm-Any'(Val, [<<48>>]).'enc_SignatureAlgorithm-Any'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,%%-------------------------------------------------%% attribute algorithm(1) with type OBJECT IDENTIFIER%%------------------------------------------------- {EncBytes1,EncLen1} = ?RT_BER:encode_object_identifier(Cindex1, [<<6>>]),%%-------------------------------------------------%% attribute parameters(2) with type ASN1_OPEN_TYPE OPTIONAL%%------------------------------------------------- {EncBytes2,EncLen2} = case Cindex2 of asn1_NOVALUE -> {<<>>,0}; _ -> ?RT_BER:encode_open_type(Cindex2, []) end, BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_SignatureAlgorithm-Any'(Tlv) -> 'dec_SignatureAlgorithm-Any'(Tlv, [16]).'dec_SignatureAlgorithm-Any'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute algorithm(1) with type OBJECT IDENTIFIER%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = ?RT_BER:decode_object_identifier(V1,[6]),%%-------------------------------------------------%% attribute parameters(2) with type ASN1_OPEN_TYPE OPTIONAL%%-------------------------------------------------{Term2,Tlv3} = case Tlv2 of[V2|TempTlv3] -> {?RT_BER:decode_open_type_as_binary(V2,[]), TempTlv3}; _ -> { asn1_NOVALUE, Tlv2}end,case Tlv3 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv3}}}) % extra fields not allowedend, {'SignatureAlgorithm-Any', Term1, Term2}.%%================================%% PublicKeyAlgorithm%%================================'enc_PublicKeyAlgorithm'(Val) -> 'enc_PublicKeyAlgorithm'(Val, [<<48>>]).'enc_PublicKeyAlgorithm'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,Objalgorithm = 'getenc_SupportedPublicKeyAlgorithms'(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_PublicKeyAlgorithm'(Tlv) -> 'dec_PublicKeyAlgorithm'(Tlv, [16]).'dec_PublicKeyAlgorithm'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute algorithm(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,DecObjalgorithmTerm1 = 'getdec_SupportedPublicKeyAlgorithms'(id, Term1),Term2 = case Tmpterm1 of asn1_NOVALUE ->asn1_NOVALUE; _ -> case (catch DecObjalgorithmTerm1('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, {'PublicKeyAlgorithm', Term1, Term2}.%%================================%% KEA-PublicKey%%================================'enc_KEA-PublicKey'(Val) -> 'enc_KEA-PublicKey'(Val, [<<2>>]).'enc_KEA-PublicKey'({'KEA-PublicKey',Val}, TagIn) -> 'enc_KEA-PublicKey'(Val, TagIn);'enc_KEA-PublicKey'(Val, TagIn) ->?RT_BER:encode_integer([], Val, TagIn).'dec_KEA-PublicKey'(Tlv) -> 'dec_KEA-PublicKey'(Tlv, [2]).'dec_KEA-PublicKey'(Tlv, TagIn) ->?RT_BER:decode_integer(Tlv,[],TagIn).%%================================%% FieldID%%================================'enc_FieldID'(Val) -> 'enc_FieldID'(Val, [<<48>>]).'enc_FieldID'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,ObjfieldType = 'getenc_SupportedFieldIds'(id, Cindex1),%%-------------------------------------------------%% attribute fieldType(1) with type fixedtypevaluefieldidtypetagUNIVERSAL6IMPLICIT0OBJECT IDENTIFIERno%%------------------------------------------------- {EncBytes1,EncLen1} = ?RT_BER:encode_object_identifier(Cindex1, [<<6>>]),%%-------------------------------------------------%% attribute parameters(2) with type typefieldType%%------------------------------------------------- {TmpBytes1,_} = ObjfieldType('Type', Cindex2, []), {EncBytes2,EncLen2} = ?RT_BER:encode_open_type(TmpBytes1,[]), BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_FieldID'(Tlv) -> 'dec_FieldID'(Tlv, [16]).'dec_FieldID'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute fieldType(1) with type fixedtypevaluefieldidtypetagUNIVERSAL6IMPLICIT0OBJECT IDENTIFIERno%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = ?RT_BER:decode_object_identifier(V1,[6]),%%-------------------------------------------------%% attribute parameters(2) with type typefieldType%%-------------------------------------------------[V2|Tlv3] = Tlv2, Tmpterm1 = ?RT_BER:decode_open_type(V2,[]),DecObjfieldTypeTerm1 = 'getdec_SupportedFieldIds'(id, Term1),Term2 = case (catch DecObjfieldTypeTerm1('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, {'FieldID', Term1, Term2}.%%================================%% Characteristic-two%%================================'enc_Characteristic-two'(Val) -> 'enc_Characteristic-two'(Val, [<<48>>]).'enc_Characteristic-two'(Val, TagIn) ->{_,Cindex1, Cindex2, Cindex3} = Val,Objbasis = 'getenc_SupportedCharacteristicTwos'(id, Cindex2),%%-------------------------------------------------%% attribute m(1) with type INTEGER%%------------------------------------------------- {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<2>>]),%%-------------------------------------------------%% attribute basis(2) with type fixedtypevaluefieldidtypetagUNIVERSAL6IMPLICIT0OBJECT IDENTIFIERno%%------------------------------------------------- {EncBytes2,EncLen2} = ?RT_BER:encode_object_identifier(Cindex2, [<<6>>]),%%-------------------------------------------------%% attribute parameters(3) with type typefieldType%%------------------------------------------------- {TmpBytes1,_} = Objbasis('Type', Cindex3, []), {EncBytes3,EncLen3} = ?RT_BER:encode_open_type(TmpBytes1,[]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],LenSoFar = EncLen1 + EncLen2 + EncLen3,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_Characteristic-two'(Tlv) -> 'dec_Characteristic-two'(Tlv, [16]).'dec_Characteristic-two'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute m(1) with type INTEGER%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = ?RT_BER:decode_integer(V1,[],[2]),%%-------------------------------------------------%% attribute basis(2) with type fixedtypevaluefieldidtypetagUNIVERSAL6IMPLICIT0OBJECT IDENTIFIERno%%-------------------------------------------------[V2|Tlv3] = Tlv2, Term2 = ?RT_BER:decode_object_identifier(V2,[6]),%%-------------------------------------------------%% attribute parameters(3) with type typefieldType%%-------------------------------------------------[V3|Tlv4] = Tlv3, Tmpterm1 = ?RT_BER:decode_open_type(V3,[]),DecObjbasisTerm2 = 'getdec_SupportedCharacteristicTwos'(id, Term2),Term3 = case (catch DecObjbasisTerm2('Type', Tmpterm1, [])) of {'EXIT', Reason1} -> exit({'Type not compatible with table constraint',Reason1}); Tmpterm2 -> Tmpterm2 end,case Tlv4 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowedend, {'Characteristic-two', Term1, Term2, Term3}.%%================================%% ExtensionAttributes%%================================'enc_ExtensionAttributes'(Val) -> 'enc_ExtensionAttributes'(Val, [<<49>>]).'enc_ExtensionAttributes'({'ExtensionAttributes',Val}, TagIn) -> 'enc_ExtensionAttributes'(Val, TagIn);'enc_ExtensionAttributes'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_ExtensionAttributes_components'(Val,[],0), ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'enc_ExtensionAttributes_components'([], AccBytes, AccLen) -> {asn1rt_check:dynamicsort_SETOF(AccBytes),AccLen};'enc_ExtensionAttributes_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'enc_ExtensionAttribute'(H, [<<48>>]), 'enc_ExtensionAttributes_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_ExtensionAttributes'(Tlv) -> 'dec_ExtensionAttributes'(Tlv, [17]).'dec_ExtensionAttributes'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), ['dec_ExtensionAttribute'(V1, [16]) || V1 <- Tlv1].%%================================%% ExtensionAttribute%%================================'enc_ExtensionAttribute'(Val) -> 'enc_ExtensionAttribute'(Val, [<<48>>]).'enc_ExtensionAttribute'(Val, TagIn) ->{_,Cindex1, Cindex2} = Val,ObjextensionAttributeType = 'getenc_SupportedExtensionAttributes'(id, Cindex1),%%-------------------------------------------------%% attribute extensionAttributeType(1) with type fixedtypevaluefieldidtypetagUNIVERSAL2IMPLICIT0INTEGERno%%------------------------------------------------- {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [<<128>>]),%%-------------------------------------------------%% attribute extensionAttributeValue(2) with type typefieldType%%------------------------------------------------- {TmpBytes1,_} = ObjextensionAttributeType('Type', Cindex2, []), {EncBytes2,EncLen2} = ?RT_BER:encode_open_type(TmpBytes1,[<<161>>]), BytesSoFar = [EncBytes1, EncBytes2],LenSoFar = EncLen1 + EncLen2,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_ExtensionAttribute'(Tlv) -> 'dec_ExtensionAttribute'(Tlv, [16]).'dec_ExtensionAttribute'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute extensionAttributeType(1) with type fixedtypevaluefieldidtypetagUNIVERSAL2IMPLICIT0INTEGERno%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = ?RT_BER:decode_integer(V1,[],[131072]),%%-------------------------------------------------%% attribute extensionAttributeValue(2) with type typefieldType%%-------------------------------------------------[V2|Tlv3] = Tlv2,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -