pkixattributecertificate.erl
来自「OTP是开放电信平台的简称」· ERL 代码 · 共 1,806 行 · 第 1/4 页
ERL
1,806 行
%% Generated by the Erlang ASN.1 BER_V2-compiler version, utilizing bit-syntax:1.4.5%% Purpose: encoder and decoder to the types in mod PKIXAttributeCertificate-module('PKIXAttributeCertificate').-include("PKIXAttributeCertificate.hrl").-define('RT_BER',asn1rt_ber_bin_v2).-asn1_info([{vsn,'1.4.5'}, {module,'PKIXAttributeCertificate'}, {options,[ber_bin_v2,report_errors,{cwd,[47,108,100,105,115,107,47,100,97,105,108,121,95,98,117,105,108,100,47,111,116,112,95,112,114,101,98,117,105,108,100,95,114,49,49,98,46,50,48,48,55,45,48,54,45,49,49,95,49,57,47,111,116,112,95,115,114,99,95,82,49,49,66,45,53,47,108,105,98,47,115,115,108,47,112,107,105,120]},{outdir,[47,108,100,105,115,107,47,100,97,105,108,121,95,98,117,105,108,100,47,111,116,112,95,112,114,101,98,117,105,108,100,95,114,49,49,98,46,50,48,48,55,45,48,54,45,49,49,95,49,57,47,111,116,112,95,115,114,99,95,82,49,49,66,45,53,47,108,105,98,47,115,115,108,47,112,107,105,120]},noobj,optimize,compact_bit_string,der,{i,[46]},{i,[47,108,100,105,115,107,47,100,97,105,108,121,95,98,117,105,108,100,47,111,116,112,95,112,114,101,98,117,105,108,100,95,114,49,49,98,46,50,48,48,55,45,48,54,45,49,49,95,49,57,47,111,116,112,95,115,114,99,95,82,49,49,66,45,53,47,108,105,98,47,115,115,108,47,112,107,105,120]}]}]).-export([encoding_rule/0]).-export(['enc_AttributeCertificate'/2,'enc_AttributeCertificateInfo'/2,'enc_AttCertVersion'/2,'enc_Holder'/2,'enc_ObjectDigestInfo'/2,'enc_AttCertIssuer'/2,'enc_V2Form'/2,'enc_IssuerSerial'/2,'enc_AttCertValidityPeriod'/2,'enc_Targets'/2,'enc_Target'/2,'enc_TargetCert'/2,'enc_IetfAttrSyntax'/2,'enc_SvceAuthInfo'/2,'enc_RoleSyntax'/2,'enc_Clearance'/2,'enc_ClassList'/2,'enc_SecurityCategory'/2,'enc_AAControls'/2,'enc_AttrSpec'/2,'enc_ACClearAttrs'/2,'enc_ProxyInfo'/2]).-export(['dec_AttributeCertificate'/2,'dec_AttributeCertificateInfo'/2,'dec_AttCertVersion'/2,'dec_Holder'/2,'dec_ObjectDigestInfo'/2,'dec_AttCertIssuer'/2,'dec_V2Form'/2,'dec_IssuerSerial'/2,'dec_AttCertValidityPeriod'/2,'dec_Targets'/2,'dec_Target'/2,'dec_TargetCert'/2,'dec_IetfAttrSyntax'/2,'dec_SvceAuthInfo'/2,'dec_RoleSyntax'/2,'dec_Clearance'/2,'dec_ClassList'/2,'dec_SecurityCategory'/2,'dec_AAControls'/2,'dec_AttrSpec'/2,'dec_ACClearAttrs'/2,'dec_ProxyInfo'/2]).-export(['id-pe-ac-auditIdentity'/0,'id-pe-aaControls'/0,'id-pe-ac-proxying'/0,'id-ce-targetInformation'/0,'id-aca'/0,'id-aca-authenticationInfo'/0,'id-aca-accessIdentity'/0,'id-aca-chargingIdentity'/0,'id-aca-group'/0,'id-aca-encAttrs'/0,'id-at-role'/0,'id-at-clearance'/0]).-export([info/0]).-export([encode/2,decode/2,encode_disp/2,decode_disp/2]).encoding_rule() -> ber_bin_v2.encode(Type,Data) ->case catch encode_disp(Type,Data) of {'EXIT',{error,Reason}} -> {error,Reason}; {'EXIT',Reason} -> {error,{asn1,Reason}}; {Bytes,_Len} -> {ok,Bytes}; Bytes -> {ok,Bytes}end.decode(Type,Data) ->case catch decode_disp(Type,element(1,?RT_BER:decode(Data))) of {'EXIT',{error,Reason}} -> {error,Reason}; {'EXIT',Reason} -> {error,{asn1,Reason}}; Result -> {ok,Result}end.encode_disp('AttributeCertificate',Data) -> 'enc_AttributeCertificate'(Data);encode_disp('AttributeCertificateInfo',Data) -> 'enc_AttributeCertificateInfo'(Data);encode_disp('AttCertVersion',Data) -> 'enc_AttCertVersion'(Data);encode_disp('Holder',Data) -> 'enc_Holder'(Data);encode_disp('ObjectDigestInfo',Data) -> 'enc_ObjectDigestInfo'(Data);encode_disp('AttCertIssuer',Data) -> 'enc_AttCertIssuer'(Data);encode_disp('V2Form',Data) -> 'enc_V2Form'(Data);encode_disp('IssuerSerial',Data) -> 'enc_IssuerSerial'(Data);encode_disp('AttCertValidityPeriod',Data) -> 'enc_AttCertValidityPeriod'(Data);encode_disp('Targets',Data) -> 'enc_Targets'(Data);encode_disp('Target',Data) -> 'enc_Target'(Data);encode_disp('TargetCert',Data) -> 'enc_TargetCert'(Data);encode_disp('IetfAttrSyntax',Data) -> 'enc_IetfAttrSyntax'(Data);encode_disp('SvceAuthInfo',Data) -> 'enc_SvceAuthInfo'(Data);encode_disp('RoleSyntax',Data) -> 'enc_RoleSyntax'(Data);encode_disp('Clearance',Data) -> 'enc_Clearance'(Data);encode_disp('ClassList',Data) -> 'enc_ClassList'(Data);encode_disp('SecurityCategory',Data) -> 'enc_SecurityCategory'(Data);encode_disp('AAControls',Data) -> 'enc_AAControls'(Data);encode_disp('AttrSpec',Data) -> 'enc_AttrSpec'(Data);encode_disp('ACClearAttrs',Data) -> 'enc_ACClearAttrs'(Data);encode_disp('ProxyInfo',Data) -> 'enc_ProxyInfo'(Data);encode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).decode_disp('AttributeCertificate',Data) -> 'dec_AttributeCertificate'(Data);decode_disp('AttributeCertificateInfo',Data) -> 'dec_AttributeCertificateInfo'(Data);decode_disp('AttCertVersion',Data) -> 'dec_AttCertVersion'(Data);decode_disp('Holder',Data) -> 'dec_Holder'(Data);decode_disp('ObjectDigestInfo',Data) -> 'dec_ObjectDigestInfo'(Data);decode_disp('AttCertIssuer',Data) -> 'dec_AttCertIssuer'(Data);decode_disp('V2Form',Data) -> 'dec_V2Form'(Data);decode_disp('IssuerSerial',Data) -> 'dec_IssuerSerial'(Data);decode_disp('AttCertValidityPeriod',Data) -> 'dec_AttCertValidityPeriod'(Data);decode_disp('Targets',Data) -> 'dec_Targets'(Data);decode_disp('Target',Data) -> 'dec_Target'(Data);decode_disp('TargetCert',Data) -> 'dec_TargetCert'(Data);decode_disp('IetfAttrSyntax',Data) -> 'dec_IetfAttrSyntax'(Data);decode_disp('SvceAuthInfo',Data) -> 'dec_SvceAuthInfo'(Data);decode_disp('RoleSyntax',Data) -> 'dec_RoleSyntax'(Data);decode_disp('Clearance',Data) -> 'dec_Clearance'(Data);decode_disp('ClassList',Data) -> 'dec_ClassList'(Data);decode_disp('SecurityCategory',Data) -> 'dec_SecurityCategory'(Data);decode_disp('AAControls',Data) -> 'dec_AAControls'(Data);decode_disp('AttrSpec',Data) -> 'dec_AttrSpec'(Data);decode_disp('ACClearAttrs',Data) -> 'dec_ACClearAttrs'(Data);decode_disp('ProxyInfo',Data) -> 'dec_ProxyInfo'(Data);decode_disp(Type,_Data) -> exit({error,{asn1,{undefined_type,Type}}}).info() -> case ?MODULE:module_info() of MI when is_list(MI) -> case lists:keysearch(attributes,1,MI) of {value,{_,Attributes}} when is_list(Attributes) -> case lists:keysearch(asn1_info,1,Attributes) of {value,{_,Info}} when is_list(Info) -> Info; _ -> [] end; _ -> [] end end.%%================================%% AttributeCertificate%%================================'enc_AttributeCertificate'(Val) -> 'enc_AttributeCertificate'(Val, [<<48>>]).'enc_AttributeCertificate'(Val, TagIn) ->{_,Cindex1, Cindex2, Cindex3} = Val,%%-------------------------------------------------%% attribute acinfo(1) External PKIXAttributeCertificate:AttributeCertificateInfo%%------------------------------------------------- {EncBytes1,EncLen1} = 'enc_AttributeCertificateInfo'(Cindex1, [<<48>>]),%%-------------------------------------------------%% attribute signatureAlgorithm(2) External PKIX1Explicit88:AlgorithmIdentifier%%------------------------------------------------- {EncBytes2,EncLen2} = 'PKIX1Explicit88':'enc_AlgorithmIdentifier'(Cindex2, [<<48>>]),%%-------------------------------------------------%% attribute signatureValue(3) with type BIT STRING%%------------------------------------------------- {EncBytes3,EncLen3} = ?RT_BER:encode_bit_string([], Cindex3, [], [<<3>>]), BytesSoFar = [EncBytes1, EncBytes2, EncBytes3],LenSoFar = EncLen1 + EncLen2 + EncLen3,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).'dec_AttributeCertificate'(Tlv) -> 'dec_AttributeCertificate'(Tlv, [16]).'dec_AttributeCertificate'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute acinfo(1) External PKIXAttributeCertificate:AttributeCertificateInfo%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = 'dec_AttributeCertificateInfo'(V1, [16]),%%-------------------------------------------------%% attribute signatureAlgorithm(2) External PKIX1Explicit88:AlgorithmIdentifier%%-------------------------------------------------[V2|Tlv3] = Tlv2, Term2 = 'PKIX1Explicit88':'dec_AlgorithmIdentifier'(V2, [16]),%%-------------------------------------------------%% attribute signatureValue(3) with type BIT STRING%%-------------------------------------------------[V3|Tlv4] = Tlv3, Term3 = ?RT_BER:decode_compact_bit_string(V3,[],[],[3]),case Tlv4 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv4}}}) % extra fields not allowedend, {'AttributeCertificate', Term1, Term2, Term3}.%%================================%% AttributeCertificateInfo%%================================'enc_AttributeCertificateInfo'(Val) -> 'enc_AttributeCertificateInfo'(Val, [<<48>>]).'enc_AttributeCertificateInfo'(Val, TagIn) ->{_,Cindex1, Cindex2, Cindex3, Cindex4, Cindex5, Cindex6, Cindex7, Cindex8, Cindex9} = Val,%%-------------------------------------------------%% attribute version(1) with type INTEGER%%------------------------------------------------- {EncBytes1,EncLen1} = ?RT_BER:encode_integer([], Cindex1, [{v2,1}], [<<2>>]),%%-------------------------------------------------%% attribute holder(2) External PKIXAttributeCertificate:Holder%%------------------------------------------------- {EncBytes2,EncLen2} = 'enc_Holder'(Cindex2, [<<48>>]),%%-------------------------------------------------%% attribute issuer(3) External PKIXAttributeCertificate:AttCertIssuer%%------------------------------------------------- {EncBytes3,EncLen3} = 'enc_AttCertIssuer'(Cindex3, []),%%-------------------------------------------------%% attribute signature(4) External PKIX1Explicit88:AlgorithmIdentifier%%------------------------------------------------- {EncBytes4,EncLen4} = 'PKIX1Explicit88':'enc_AlgorithmIdentifier'(Cindex4, [<<48>>]),%%-------------------------------------------------%% attribute serialNumber(5) with type INTEGER%%------------------------------------------------- {EncBytes5,EncLen5} = ?RT_BER:encode_integer([], Cindex5, [<<2>>]),%%-------------------------------------------------%% attribute attrCertValidityPeriod(6) External PKIXAttributeCertificate:AttCertValidityPeriod%%------------------------------------------------- {EncBytes6,EncLen6} = 'enc_AttCertValidityPeriod'(Cindex6, [<<48>>]),%%-------------------------------------------------%% attribute attributes(7) with type SEQUENCE OF%%------------------------------------------------- {EncBytes7,EncLen7} = 'enc_AttributeCertificateInfo_attributes'(Cindex7, [<<48>>]),%%-------------------------------------------------%% attribute issuerUniqueID(8) with type BIT STRING OPTIONAL%%------------------------------------------------- {EncBytes8,EncLen8} = case Cindex8 of asn1_NOVALUE -> {<<>>,0}; _ -> ?RT_BER:encode_bit_string([], Cindex8, [], [<<3>>]) end,%%-------------------------------------------------%% attribute extensions(9) External PKIX1Explicit88:Extensions OPTIONAL%%------------------------------------------------- {EncBytes9,EncLen9} = case Cindex9 of asn1_NOVALUE -> {<<>>,0}; _ -> 'PKIX1Explicit88':'enc_Extensions'(Cindex9, [<<48>>]) end, BytesSoFar = [EncBytes1, EncBytes2, EncBytes3, EncBytes4, EncBytes5, EncBytes6, EncBytes7, EncBytes8, EncBytes9],LenSoFar = EncLen1 + EncLen2 + EncLen3 + EncLen4 + EncLen5 + EncLen6 + EncLen7 + EncLen8 + EncLen9,?RT_BER:encode_tags(TagIn, BytesSoFar, LenSoFar).%%================================%% AttributeCertificateInfo_attributes%%================================'enc_AttributeCertificateInfo_attributes'({'AttributeCertificateInfo_attributes',Val}, TagIn) -> 'enc_AttributeCertificateInfo_attributes'(Val, TagIn);'enc_AttributeCertificateInfo_attributes'(Val, TagIn) -> {EncBytes,EncLen} = 'enc_AttributeCertificateInfo_attributes_components'(Val,[],0), ?RT_BER:encode_tags(TagIn, EncBytes, EncLen).'enc_AttributeCertificateInfo_attributes_components'([], AccBytes, AccLen) -> {lists:reverse(AccBytes),AccLen};'enc_AttributeCertificateInfo_attributes_components'([H|T],AccBytes, AccLen) -> {EncBytes,EncLen} = 'PKIX1Explicit88':'enc_Attribute'(H, [<<48>>]), 'enc_AttributeCertificateInfo_attributes_components'(T,[EncBytes|AccBytes], AccLen + EncLen).'dec_AttributeCertificateInfo_attributes'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), ['PKIX1Explicit88':'dec_Attribute'(V1, [16]) || V1 <- Tlv1].'dec_AttributeCertificateInfo'(Tlv) -> 'dec_AttributeCertificateInfo'(Tlv, [16]).'dec_AttributeCertificateInfo'(Tlv, TagIn) -> %%------------------------------------------------- %% decode tag and length %%-------------------------------------------------Tlv1 = ?RT_BER:match_tags(Tlv,TagIn), %%-------------------------------------------------%% attribute version(1) with type INTEGER%%-------------------------------------------------[V1|Tlv2] = Tlv1, Term1 = ?RT_BER:decode_integer(V1,[],[{v2,1}],[2]),%%-------------------------------------------------%% attribute holder(2) External PKIXAttributeCertificate:Holder%%-------------------------------------------------[V2|Tlv3] = Tlv2, Term2 = 'dec_Holder'(V2, [16]),%%-------------------------------------------------%% attribute issuer(3) External PKIXAttributeCertificate:AttCertIssuer%%-------------------------------------------------[V3|Tlv4] = Tlv3, Term3 = 'dec_AttCertIssuer'(V3, []),%%-------------------------------------------------%% attribute signature(4) External PKIX1Explicit88:AlgorithmIdentifier%%-------------------------------------------------[V4|Tlv5] = Tlv4, Term4 = 'PKIX1Explicit88':'dec_AlgorithmIdentifier'(V4, [16]),%%-------------------------------------------------%% attribute serialNumber(5) with type INTEGER%%-------------------------------------------------[V5|Tlv6] = Tlv5, Term5 = ?RT_BER:decode_integer(V5,[],[2]),%%-------------------------------------------------%% attribute attrCertValidityPeriod(6) External PKIXAttributeCertificate:AttCertValidityPeriod%%-------------------------------------------------[V6|Tlv7] = Tlv6, Term6 = 'dec_AttCertValidityPeriod'(V6, [16]),%%-------------------------------------------------%% attribute attributes(7) with type SEQUENCE OF%%-------------------------------------------------[V7|Tlv8] = Tlv7, Term7 = 'dec_AttributeCertificateInfo_attributes'(V7, [16]),%%-------------------------------------------------%% attribute issuerUniqueID(8) with type BIT STRING OPTIONAL%%-------------------------------------------------{Term8,Tlv9} = case Tlv8 of[{3,V8}|TempTlv9] -> {?RT_BER:decode_compact_bit_string(V8,[],[],[]), TempTlv9}; _ -> { asn1_NOVALUE, Tlv8}end,%%-------------------------------------------------%% attribute extensions(9) External PKIX1Explicit88:Extensions OPTIONAL%%-------------------------------------------------{Term9,Tlv10} = case Tlv9 of[{16,V9}|TempTlv10] -> {'PKIX1Explicit88':'dec_Extensions'(V9, []), TempTlv10}; _ -> { asn1_NOVALUE, Tlv9}end,case Tlv10 of[] -> true;_ -> exit({error,{asn1, {unexpected,Tlv10}}}) % extra fields not allowedend, {'AttributeCertificateInfo', Term1, Term2, Term3, Term4, Term5, Term6, Term7, Term8, Term9}.%%================================%% AttCertVersion%%================================'enc_AttCertVersion'(Val) -> 'enc_AttCertVersion'(Val, [<<2>>]).'enc_AttCertVersion'({'AttCertVersion',Val}, TagIn) -> 'enc_AttCertVersion'(Val, TagIn);'enc_AttCertVersion'(Val, TagIn) ->?RT_BER:encode_integer([], Val, [{v2,1}], TagIn).'dec_AttCertVersion'(Tlv) -> 'dec_AttCertVersion'(Tlv, [2]).'dec_AttCertVersion'(Tlv, TagIn) ->?RT_BER:decode_integer(Tlv,[],[{v2,1}],TagIn).%%================================%% Holder%%================================'enc_Holder'(Val) -> 'enc_Holder'(Val, [<<48>>]).'enc_Holder'(Val, TagIn) ->{_,Cindex1, Cindex2, Cindex3} = Val,%%-------------------------------------------------%% attribute baseCertificateID(1) External PKIXAttributeCertificate:IssuerSerial OPTIONAL%%------------------------------------------------- {EncBytes1,EncLen1} = case Cindex1 of asn1_NOVALUE -> {<<>>,0}; _ -> 'enc_IssuerSerial'(Cindex1, [<<160>>])
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?