authing_ruby 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/authing_ruby.gemspec +30 -0
- data/lib/authing_ruby/GraphQLAPI.rb +151 -0
- data/lib/authing_ruby/authentication/AuthenticationClient.rb +801 -0
- data/lib/authing_ruby/authentication/AuthenticationTokenProvider.rb +42 -0
- data/lib/authing_ruby/authentication/BaseAuthenticationClient.rb +28 -0
- data/lib/authing_ruby/common/GraphqlClient.rb +39 -0
- data/lib/authing_ruby/common/HttpClient.rb +247 -0
- data/lib/authing_ruby/common/PublicKeyManager.rb +42 -0
- data/lib/authing_ruby/graphql/mutations/bindPhone.gql +53 -0
- data/lib/authing_ruby/graphql/mutations/createUser.gql +54 -0
- data/lib/authing_ruby/graphql/mutations/deleteUser.gql +6 -0
- data/lib/authing_ruby/graphql/mutations/deleteUsers.gql +6 -0
- data/lib/authing_ruby/graphql/mutations/loginByEmail.gql +54 -0
- data/lib/authing_ruby/graphql/mutations/loginByPhoneCode.gql +54 -0
- data/lib/authing_ruby/graphql/mutations/loginByPhonePassword.gql +54 -0
- data/lib/authing_ruby/graphql/mutations/loginByUsername.gql +54 -0
- data/lib/authing_ruby/graphql/mutations/refreshAccessToken.gql +7 -0
- data/lib/authing_ruby/graphql/mutations/registerByEmail.gql +54 -0
- data/lib/authing_ruby/graphql/mutations/registerByPhoneCode.gql +54 -0
- data/lib/authing_ruby/graphql/mutations/registerByUsername.gql +54 -0
- data/lib/authing_ruby/graphql/mutations/resetPassword.gql +6 -0
- data/lib/authing_ruby/graphql/mutations/sendEmail.gql +6 -0
- data/lib/authing_ruby/graphql/mutations/updatePassword.gql +53 -0
- data/lib/authing_ruby/graphql/mutations/updateUser.gql +54 -0
- data/lib/authing_ruby/graphql/queries/accessToken.gql +7 -0
- data/lib/authing_ruby/graphql/queries/checkLoginStatus.gql +14 -0
- data/lib/authing_ruby/graphql/queries/checkPasswordStrength.gql +6 -0
- data/lib/authing_ruby/graphql/queries/findUser.gql +64 -0
- data/lib/authing_ruby/graphql/queries/isUserExists.gql +13 -0
- data/lib/authing_ruby/graphql/queries/user.gql +63 -0
- data/lib/authing_ruby/graphql/queries/users.gql +57 -0
- data/lib/authing_ruby/management/AclManagementClient.rb +47 -0
- data/lib/authing_ruby/management/ApplicationsManagementClient.rb +79 -0
- data/lib/authing_ruby/management/ManagementClient.rb +66 -0
- data/lib/authing_ruby/management/ManagementTokenProvider.rb +92 -0
- data/lib/authing_ruby/management/RolesManagementClient.rb +38 -0
- data/lib/authing_ruby/management/UserpoolManagementClient.rb +15 -0
- data/lib/authing_ruby/management/UsersManagementClient.rb +161 -0
- data/lib/authing_ruby/management/WhitelistManagementClient.rb +1 -0
- data/lib/authing_ruby/test/RSA.rb +18 -0
- data/lib/authing_ruby/test/helper.rb +15 -0
- data/lib/authing_ruby/test/js_sdk_test/1.buildAuthorizeUrl.js +43 -0
- data/lib/authing_ruby/test/js_sdk_test/2.buildAuthorizeUrl_PKCE.js +47 -0
- data/lib/authing_ruby/test/js_sdk_test/README.md +5 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/CONTRIBUTION.md +23 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/LICENSE +21 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/README.md +303 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/browser/index.min.js +2 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/browser/index.min.js.LICENSE.txt +91 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/index.d.ts +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/index.js +20 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/AuthenticationClient.d.ts +1078 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/AuthenticationClient.js +2801 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/AuthenticationTokenProvider.d.ts +13 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/AuthenticationTokenProvider.js +56 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/BaseAuthenticationClient.d.ts +6 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/BaseAuthenticationClient.js +31 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/EnterpriseAuthenticationClient.d.ts +92 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/EnterpriseAuthenticationClient.js +250 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/MfaAuthenticationClient.d.ts +303 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/MfaAuthenticationClient.js +665 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/QrCodeAuthenticationClient.d.ts +232 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/QrCodeAuthenticationClient.js +619 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/SocialAuthenticationClient.d.ts +100 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/SocialAuthenticationClient.js +179 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/types.d.ts +331 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/authentication/types.js +69 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/GraphqlClient.d.ts +14 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/GraphqlClient.js +125 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/HttpClient.d.ts +19 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/HttpClient.js +149 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/PublicKeyManager.d.ts +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/common/PublicKeyManager.js +81 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/graphqlapi.d.ts +110 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/graphqlapi.js +1812 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/AclManagementClient.d.ts +236 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/AclManagementClient.js +863 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/AgreementManagementClient.d.ts +65 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/AgreementManagementClient.js +195 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ApplicationsManagementClient.d.ts +216 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ApplicationsManagementClient.js +531 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/GroupsManagementClient.d.ts +184 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/GroupsManagementClient.js +386 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/MFAManagementClient.d.ts +58 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/MFAManagementClient.js +126 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ManagementClient.d.ts +74 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ManagementClient.js +190 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ManagementTokenProvider.d.ts +39 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/ManagementTokenProvider.js +159 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/OrgManagementClient.d.ts +488 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/OrgManagementClient.js +772 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/PoliciesManagementClient.d.ts +304 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/PoliciesManagementClient.js +512 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/RolesManagementClient.d.ts +291 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/RolesManagementClient.js +676 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/StatisticsManagementClient.d.ts +56 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/StatisticsManagementClient.js +198 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UdfManagementClient.d.ts +146 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UdfManagementClient.js +264 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UserActionManagementClient.d.ts +44 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UserActionManagementClient.js +106 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UserpoolManagementClient.d.ts +142 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UserpoolManagementClient.js +241 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UsersManagementClient.d.ts +753 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/UsersManagementClient.js +1114 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/WhitelistManagementClient.d.ts +114 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/WhitelistManagementClient.js +259 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/types.d.ts +982 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/management/types.js +96 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/platform/express/index.d.ts +30 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/platform/express/index.js +126 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/testing-helper.d.ts +31 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/testing-helper.js +67 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/utils.d.ts +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/utils.js +343 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/version.d.ts +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/lib/version.js +5 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/types/graphql.v2.d.ts +5612 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/types/graphql.v2.js +240 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/types/index.d.ts +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/main/types/index.js +3 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/index.d.ts +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/index.js +8 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/AuthenticationClient.d.ts +1078 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/AuthenticationClient.js +2795 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/AuthenticationTokenProvider.d.ts +13 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/AuthenticationTokenProvider.js +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/BaseAuthenticationClient.d.ts +6 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/BaseAuthenticationClient.js +28 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/EnterpriseAuthenticationClient.d.ts +92 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/EnterpriseAuthenticationClient.js +247 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/MfaAuthenticationClient.d.ts +303 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/MfaAuthenticationClient.js +662 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/QrCodeAuthenticationClient.d.ts +232 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/QrCodeAuthenticationClient.js +616 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/SocialAuthenticationClient.d.ts +100 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/SocialAuthenticationClient.js +176 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/types.d.ts +331 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/authentication/types.js +66 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/GraphqlClient.d.ts +14 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/GraphqlClient.js +119 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/HttpClient.d.ts +19 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/HttpClient.js +143 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/PublicKeyManager.d.ts +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/common/PublicKeyManager.js +78 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/graphqlapi.d.ts +110 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/graphqlapi.js +1809 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/AclManagementClient.d.ts +236 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/AclManagementClient.js +860 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/AgreementManagementClient.d.ts +65 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/AgreementManagementClient.js +192 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ApplicationsManagementClient.d.ts +216 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ApplicationsManagementClient.js +528 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/GroupsManagementClient.d.ts +184 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/GroupsManagementClient.js +383 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/MFAManagementClient.d.ts +58 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/MFAManagementClient.js +123 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ManagementClient.d.ts +74 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ManagementClient.js +184 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ManagementTokenProvider.d.ts +39 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/ManagementTokenProvider.js +153 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/OrgManagementClient.d.ts +488 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/OrgManagementClient.js +750 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/PoliciesManagementClient.d.ts +304 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/PoliciesManagementClient.js +509 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/RolesManagementClient.d.ts +291 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/RolesManagementClient.js +673 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/StatisticsManagementClient.d.ts +56 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/StatisticsManagementClient.js +195 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UdfManagementClient.d.ts +146 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UdfManagementClient.js +261 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UserActionManagementClient.d.ts +44 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UserActionManagementClient.js +103 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UserpoolManagementClient.d.ts +142 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UserpoolManagementClient.js +238 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UsersManagementClient.d.ts +753 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/UsersManagementClient.js +1111 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/WhitelistManagementClient.d.ts +114 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/WhitelistManagementClient.js +256 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/types.d.ts +982 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/management/types.js +93 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/platform/express/index.d.ts +30 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/platform/express/index.js +123 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/testing-helper.d.ts +31 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/testing-helper.js +62 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/utils.d.ts +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/utils.js +336 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/version.d.ts +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/lib/version.js +2 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/types/graphql.v2.d.ts +5612 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/types/graphql.v2.js +237 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/types/index.d.ts +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/module/types/index.js +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/index.d.ts +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/index.js +30 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/AuthenticationClient.d.ts +1078 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/AuthenticationClient.js +2811 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/AuthenticationTokenProvider.d.ts +13 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/AuthenticationTokenProvider.js +66 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/BaseAuthenticationClient.d.ts +6 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/BaseAuthenticationClient.js +41 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/EnterpriseAuthenticationClient.d.ts +92 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/EnterpriseAuthenticationClient.js +260 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/MfaAuthenticationClient.d.ts +303 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/MfaAuthenticationClient.js +675 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/QrCodeAuthenticationClient.d.ts +232 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/QrCodeAuthenticationClient.js +629 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/SocialAuthenticationClient.d.ts +100 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/SocialAuthenticationClient.js +189 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/types.d.ts +331 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/authentication/types.js +79 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/GraphqlClient.d.ts +14 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/GraphqlClient.js +135 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/HttpClient.d.ts +19 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/HttpClient.js +159 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/PublicKeyManager.d.ts +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/common/PublicKeyManager.js +91 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/graphqlapi.d.ts +110 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/graphqlapi.js +1822 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/AclManagementClient.d.ts +236 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/AclManagementClient.js +873 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/AgreementManagementClient.d.ts +65 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/AgreementManagementClient.js +205 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ApplicationsManagementClient.d.ts +216 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ApplicationsManagementClient.js +541 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/GroupsManagementClient.d.ts +184 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/GroupsManagementClient.js +396 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/MFAManagementClient.d.ts +58 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/MFAManagementClient.js +136 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ManagementClient.d.ts +74 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ManagementClient.js +200 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ManagementTokenProvider.d.ts +39 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/ManagementTokenProvider.js +169 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/OrgManagementClient.d.ts +488 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/OrgManagementClient.js +782 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/PoliciesManagementClient.d.ts +304 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/PoliciesManagementClient.js +522 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/RolesManagementClient.d.ts +291 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/RolesManagementClient.js +686 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/StatisticsManagementClient.d.ts +56 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/StatisticsManagementClient.js +208 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UdfManagementClient.d.ts +146 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UdfManagementClient.js +274 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UserActionManagementClient.d.ts +44 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UserActionManagementClient.js +116 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UserpoolManagementClient.d.ts +142 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UserpoolManagementClient.js +251 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UsersManagementClient.d.ts +753 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/UsersManagementClient.js +1124 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/WhitelistManagementClient.d.ts +114 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/WhitelistManagementClient.js +269 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/types.d.ts +982 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/management/types.js +106 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/platform/express/index.d.ts +30 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/platform/express/index.js +136 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/testing-helper.d.ts +31 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/testing-helper.js +77 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/utils.d.ts +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/utils.js +353 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/version.d.ts +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/lib/version.js +15 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/types/graphql.v2.d.ts +5612 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/types/graphql.v2.js +250 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/types/index.d.ts +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build/umd/types/index.js +13 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/build-doc.js +520 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/CHANGELOG.md +413 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/LICENSE +19 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/README.md +709 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/UPGRADE_GUIDE.md +162 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/dist/axios.js +1715 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/dist/axios.map +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/dist/axios.min.js +3 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/dist/axios.min.map +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/index.d.ts +157 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/index.js +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/adapters/README.md +37 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/adapters/http.js +279 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/adapters/xhr.js +180 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/axios.js +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/cancel/Cancel.js +19 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/cancel/CancelToken.js +57 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/cancel/isCancel.js +5 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/Axios.js +94 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/InterceptorManager.js +52 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/README.md +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/buildFullPath.js +20 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/createError.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/dispatchRequest.js +79 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/enhanceError.js +42 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/mergeConfig.js +73 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/settle.js +25 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/core/transformData.js +20 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/defaults.js +97 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/README.md +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/bind.js +11 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/buildURL.js +71 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/combineURLs.js +14 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/cookies.js +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/deprecatedMethod.js +24 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/isURLSameOrigin.js +68 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/normalizeHeaderName.js +12 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/helpers/spread.js +27 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/lib/utils.js +344 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/axios/package.json +84 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/LICENSE +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/README.md +155 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/http.js +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/https.js +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/index.js +322 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/node_modules/follow-redirects/package.json +60 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/package.json +129 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/tests/index.html +21 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/tsconfig.brower.json +45 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/tsconfig.node.json +0 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/authing-js-sdk/webpack.config.js +41 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/CHANGELOG.md +685 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/LICENSE +19 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/README.md +800 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/UPGRADE_GUIDE.md +162 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/dist/axios.js +1756 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/dist/axios.map +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/dist/axios.min.js +3 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/dist/axios.min.map +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/index.d.ts +161 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/index.js +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/adapters/README.md +37 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/adapters/http.js +303 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/adapters/xhr.js +179 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/axios.js +56 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/cancel/Cancel.js +19 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/cancel/CancelToken.js +57 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/cancel/isCancel.js +5 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/Axios.js +95 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/InterceptorManager.js +52 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/README.md +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/buildFullPath.js +20 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/createError.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/dispatchRequest.js +79 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/enhanceError.js +42 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/mergeConfig.js +87 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/settle.js +25 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/core/transformData.js +20 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/defaults.js +98 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/README.md +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/bind.js +11 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/buildURL.js +70 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/combineURLs.js +14 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/cookies.js +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/deprecatedMethod.js +24 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/isAbsoluteURL.js +14 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/isAxiosError.js +11 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/isURLSameOrigin.js +68 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/normalizeHeaderName.js +12 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/parseHeaders.js +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/helpers/spread.js +27 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/lib/utils.js +351 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/axios/package.json +86 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/CONTRIBUTING.md +28 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/LICENSE +24 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/README.md +249 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/aes.js +234 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/bower.json +35 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/cipher-core.js +890 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/core.js +797 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/crypto-js.js +6059 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/docs/QuickStartGuide.wiki +470 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-base64.js +136 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-hex.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-latin1.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-utf16.js +149 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/enc-utf8.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/evpkdf.js +134 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/format-hex.js +66 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/format-openssl.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-md5.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-ripemd160.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha1.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha224.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha256.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha3.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha384.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac-sha512.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/hmac.js +143 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/index.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/lib-typedarrays.js +76 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/md5.js +268 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-cfb.js +80 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-ctr-gladman.js +116 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-ctr.js +58 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-ecb.js +40 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/mode-ofb.js +54 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/package.json +38 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-ansix923.js +49 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-iso10126.js +44 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-iso97971.js +40 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-nopadding.js +30 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-pkcs7.js +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pad-zeropadding.js +47 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/pbkdf2.js +145 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/rabbit-legacy.js +190 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/rabbit.js +192 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/rc4.js +139 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/ripemd160.js +267 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha1.js +150 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha224.js +80 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha256.js +199 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha3.js +326 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha384.js +83 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/sha512.js +326 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/tripledes.js +779 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/crypto-js/x64-core.js +304 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/CHANGELOG.md +395 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/LICENSE +19 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/Makefile +58 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/README.md +368 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/karma.conf.js +70 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/node.js +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/package.json +43 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/src/browser.js +195 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/src/debug.js +225 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/src/index.js +10 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/debug/src/node.js +186 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/LICENSE +18 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/README.md +148 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/debug.js +14 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/http.js +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/https.js +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/index.js +535 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/follow-redirects/package.json +59 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/LICENSE.txt +107 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/README.md +192 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/bin/jsencrypt.js +249 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/bin/jsencrypt.min.js +2 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/bin/jsencrypt.min.js.LICENSE.txt +8 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/JSEncrypt.d.ts +116 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/JSEncrypt.js +186 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/JSEncryptRSAKey.d.ts +142 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/JSEncryptRSAKey.js +315 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/index.d.ts +3 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/index.js +3 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/asn1.d.ts +51 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/asn1.js +565 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/base64.d.ts +5 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/base64.js +88 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/hex.d.ts +3 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/hex.js +64 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/int10.d.ts +9 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/int10.js +87 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/oids.d.ts +9778 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/asn1js/oids.js +1962 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/base64.d.ts +3 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/base64.js +76 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/jsbn.d.ts +98 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/jsbn.js +1754 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/prng4.d.ts +10 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/prng4.js +46 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/rng.d.ts +3 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/rng.js +76 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/rsa.d.ts +23 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/rsa.js +373 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/util.d.ts +7 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsbn/util.js +58 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsrsasign/asn1-1.0.js +1593 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/lib/jsrsasign/yahoo.js +69 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/lib/version.json +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jsencrypt/package.json +49 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/Gruntfile.js +78 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/LICENSE +21 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/README.md +55 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/bower.json +20 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/build/jwt-decode.js +125 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/build/jwt-decode.min.js +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/jwt-decode.html +2 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/lib/atob.js +38 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/lib/base64_url_decode.js +33 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/lib/index.js +26 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/package.json +37 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/standalone.js +16 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/test/tests.js +53 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/test_harness.html +29 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/testem.yml +46 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/jwt-decode/testem_dev.yml +1 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/ms/index.js +152 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/ms/license.md +21 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/ms/package.json +37 -0
- data/lib/authing_ruby/test/js_sdk_test/node_modules/ms/readme.md +51 -0
- data/lib/authing_ruby/test/js_sdk_test/package-lock.json +177 -0
- data/lib/authing_ruby/test/js_sdk_test/package.json +15 -0
- data/lib/authing_ruby/test/mini_test/TestApplicationsManagementClient.rb +85 -0
- data/lib/authing_ruby/test/mini_test/TestAuthenticationClient.rb +232 -0
- data/lib/authing_ruby/test/mini_test/TestAuthenticationClientProtocal.rb +238 -0
- data/lib/authing_ruby/test/mini_test/TestHttpClient.rb +53 -0
- data/lib/authing_ruby/test/mini_test/TestManagementClient.rb +193 -0
- data/lib/authing_ruby/test/mini_test/TestManagementTokenProvider.rb +49 -0
- data/lib/authing_ruby/test/mini_test/TestNaiveHttpClient.rb +33 -0
- data/lib/authing_ruby/test/mini_test/TestSMSandEmail.rb +101 -0
- data/lib/authing_ruby/test/mini_test/TestUtils.rb +35 -0
- data/lib/authing_ruby/utils/utils.rb +40 -0
- data/lib/authing_ruby/version.rb +6 -0
- data/lib/authing_ruby.rb +14 -0
- metadata +694 -0
@@ -0,0 +1,1593 @@
|
|
1
|
+
/* asn1-1.0.13.js (c) 2013-2017 Kenji Urushima | kjur.github.com/jsrsasign/license
|
2
|
+
*/
|
3
|
+
/*
|
4
|
+
* asn1.js - ASN.1 DER encoder classes
|
5
|
+
*
|
6
|
+
* Copyright (c) 2013-2017 Kenji Urushima (kenji.urushima@gmail.com)
|
7
|
+
*
|
8
|
+
* This software is licensed under the terms of the MIT License.
|
9
|
+
* https://kjur.github.io/jsrsasign/license
|
10
|
+
*
|
11
|
+
* The above copyright and license notice shall be
|
12
|
+
* included in all copies or substantial portions of the Software.
|
13
|
+
*/
|
14
|
+
import { BigInteger } from "../jsbn/jsbn";
|
15
|
+
import { YAHOO } from "./yahoo";
|
16
|
+
/**
|
17
|
+
* @fileOverview
|
18
|
+
* @name asn1-1.0.js
|
19
|
+
* @author Kenji Urushima kenji.urushima@gmail.com
|
20
|
+
* @version asn1 1.0.13 (2017-Jun-02)
|
21
|
+
* @since jsrsasign 2.1
|
22
|
+
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
|
23
|
+
*/
|
24
|
+
/**
|
25
|
+
* kjur's class library name space
|
26
|
+
* <p>
|
27
|
+
* This name space provides following name spaces:
|
28
|
+
* <ul>
|
29
|
+
* <li>{@link KJUR.asn1} - ASN.1 primitive hexadecimal encoder</li>
|
30
|
+
* <li>{@link KJUR.asn1.x509} - ASN.1 structure for X.509 certificate and CRL</li>
|
31
|
+
* <li>{@link KJUR.crypto} - Java Cryptographic Extension(JCE) style MessageDigest/Signature
|
32
|
+
* class and utilities</li>
|
33
|
+
* </ul>
|
34
|
+
* </p>
|
35
|
+
* NOTE: Please ignore method summary and document of this namespace. This caused by a bug of jsdoc2.
|
36
|
+
* @name KJUR
|
37
|
+
* @namespace kjur's class library name space
|
38
|
+
*/
|
39
|
+
export var KJUR = {};
|
40
|
+
/**
|
41
|
+
* kjur's ASN.1 class library name space
|
42
|
+
* <p>
|
43
|
+
* This is ITU-T X.690 ASN.1 DER encoder class library and
|
44
|
+
* class structure and methods is very similar to
|
45
|
+
* org.bouncycastle.asn1 package of
|
46
|
+
* well known BouncyCaslte Cryptography Library.
|
47
|
+
* <h4>PROVIDING ASN.1 PRIMITIVES</h4>
|
48
|
+
* Here are ASN.1 DER primitive classes.
|
49
|
+
* <ul>
|
50
|
+
* <li>0x01 {@link KJUR.asn1.DERBoolean}</li>
|
51
|
+
* <li>0x02 {@link KJUR.asn1.DERInteger}</li>
|
52
|
+
* <li>0x03 {@link KJUR.asn1.DERBitString}</li>
|
53
|
+
* <li>0x04 {@link KJUR.asn1.DEROctetString}</li>
|
54
|
+
* <li>0x05 {@link KJUR.asn1.DERNull}</li>
|
55
|
+
* <li>0x06 {@link KJUR.asn1.DERObjectIdentifier}</li>
|
56
|
+
* <li>0x0a {@link KJUR.asn1.DEREnumerated}</li>
|
57
|
+
* <li>0x0c {@link KJUR.asn1.DERUTF8String}</li>
|
58
|
+
* <li>0x12 {@link KJUR.asn1.DERNumericString}</li>
|
59
|
+
* <li>0x13 {@link KJUR.asn1.DERPrintableString}</li>
|
60
|
+
* <li>0x14 {@link KJUR.asn1.DERTeletexString}</li>
|
61
|
+
* <li>0x16 {@link KJUR.asn1.DERIA5String}</li>
|
62
|
+
* <li>0x17 {@link KJUR.asn1.DERUTCTime}</li>
|
63
|
+
* <li>0x18 {@link KJUR.asn1.DERGeneralizedTime}</li>
|
64
|
+
* <li>0x30 {@link KJUR.asn1.DERSequence}</li>
|
65
|
+
* <li>0x31 {@link KJUR.asn1.DERSet}</li>
|
66
|
+
* </ul>
|
67
|
+
* <h4>OTHER ASN.1 CLASSES</h4>
|
68
|
+
* <ul>
|
69
|
+
* <li>{@link KJUR.asn1.ASN1Object}</li>
|
70
|
+
* <li>{@link KJUR.asn1.DERAbstractString}</li>
|
71
|
+
* <li>{@link KJUR.asn1.DERAbstractTime}</li>
|
72
|
+
* <li>{@link KJUR.asn1.DERAbstractStructured}</li>
|
73
|
+
* <li>{@link KJUR.asn1.DERTaggedObject}</li>
|
74
|
+
* </ul>
|
75
|
+
* <h4>SUB NAME SPACES</h4>
|
76
|
+
* <ul>
|
77
|
+
* <li>{@link KJUR.asn1.cades} - CAdES long term signature format</li>
|
78
|
+
* <li>{@link KJUR.asn1.cms} - Cryptographic Message Syntax</li>
|
79
|
+
* <li>{@link KJUR.asn1.csr} - Certificate Signing Request (CSR/PKCS#10)</li>
|
80
|
+
* <li>{@link KJUR.asn1.tsp} - RFC 3161 Timestamping Protocol Format</li>
|
81
|
+
* <li>{@link KJUR.asn1.x509} - RFC 5280 X.509 certificate and CRL</li>
|
82
|
+
* </ul>
|
83
|
+
* </p>
|
84
|
+
* NOTE: Please ignore method summary and document of this namespace.
|
85
|
+
* This caused by a bug of jsdoc2.
|
86
|
+
* @name KJUR.asn1
|
87
|
+
* @namespace
|
88
|
+
*/
|
89
|
+
if (typeof KJUR.asn1 == "undefined" || !KJUR.asn1)
|
90
|
+
KJUR.asn1 = {};
|
91
|
+
/**
|
92
|
+
* ASN1 utilities class
|
93
|
+
* @name KJUR.asn1.ASN1Util
|
94
|
+
* @class ASN1 utilities class
|
95
|
+
* @since asn1 1.0.2
|
96
|
+
*/
|
97
|
+
KJUR.asn1.ASN1Util = new function () {
|
98
|
+
this.integerToByteHex = function (i) {
|
99
|
+
var h = i.toString(16);
|
100
|
+
if ((h.length % 2) == 1)
|
101
|
+
h = '0' + h;
|
102
|
+
return h;
|
103
|
+
};
|
104
|
+
this.bigIntToMinTwosComplementsHex = function (bigIntegerValue) {
|
105
|
+
var h = bigIntegerValue.toString(16);
|
106
|
+
if (h.substr(0, 1) != '-') {
|
107
|
+
if (h.length % 2 == 1) {
|
108
|
+
h = '0' + h;
|
109
|
+
}
|
110
|
+
else {
|
111
|
+
if (!h.match(/^[0-7]/)) {
|
112
|
+
h = '00' + h;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
}
|
116
|
+
else {
|
117
|
+
var hPos = h.substr(1);
|
118
|
+
var xorLen = hPos.length;
|
119
|
+
if (xorLen % 2 == 1) {
|
120
|
+
xorLen += 1;
|
121
|
+
}
|
122
|
+
else {
|
123
|
+
if (!h.match(/^[0-7]/)) {
|
124
|
+
xorLen += 2;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
var hMask = '';
|
128
|
+
for (var i = 0; i < xorLen; i++) {
|
129
|
+
hMask += 'f';
|
130
|
+
}
|
131
|
+
var biMask = new BigInteger(hMask, 16);
|
132
|
+
var biNeg = biMask.xor(bigIntegerValue).add(BigInteger.ONE);
|
133
|
+
h = biNeg.toString(16).replace(/^-/, '');
|
134
|
+
}
|
135
|
+
return h;
|
136
|
+
};
|
137
|
+
/**
|
138
|
+
* get PEM string from hexadecimal data and header string
|
139
|
+
* @name getPEMStringFromHex
|
140
|
+
* @memberOf KJUR.asn1.ASN1Util
|
141
|
+
* @function
|
142
|
+
* @param {String} dataHex hexadecimal string of PEM body
|
143
|
+
* @param {String} pemHeader PEM header string (ex. 'RSA PRIVATE KEY')
|
144
|
+
* @return {String} PEM formatted string of input data
|
145
|
+
* @description
|
146
|
+
* This method converts a hexadecimal string to a PEM string with
|
147
|
+
* a specified header. Its line break will be CRLF("\r\n").
|
148
|
+
* @example
|
149
|
+
* var pem = KJUR.asn1.ASN1Util.getPEMStringFromHex('616161', 'RSA PRIVATE KEY');
|
150
|
+
* // value of pem will be:
|
151
|
+
* -----BEGIN PRIVATE KEY-----
|
152
|
+
* YWFh
|
153
|
+
* -----END PRIVATE KEY-----
|
154
|
+
*/
|
155
|
+
this.getPEMStringFromHex = function (dataHex, pemHeader) {
|
156
|
+
return hextopem(dataHex, pemHeader);
|
157
|
+
};
|
158
|
+
/**
|
159
|
+
* generate ASN1Object specifed by JSON parameters
|
160
|
+
* @name newObject
|
161
|
+
* @memberOf KJUR.asn1.ASN1Util
|
162
|
+
* @function
|
163
|
+
* @param {Array} param JSON parameter to generate ASN1Object
|
164
|
+
* @return {KJUR.asn1.ASN1Object} generated object
|
165
|
+
* @since asn1 1.0.3
|
166
|
+
* @description
|
167
|
+
* generate any ASN1Object specified by JSON param
|
168
|
+
* including ASN.1 primitive or structured.
|
169
|
+
* Generally 'param' can be described as follows:
|
170
|
+
* <blockquote>
|
171
|
+
* {TYPE-OF-ASNOBJ: ASN1OBJ-PARAMETER}
|
172
|
+
* </blockquote>
|
173
|
+
* 'TYPE-OF-ASN1OBJ' can be one of following symbols:
|
174
|
+
* <ul>
|
175
|
+
* <li>'bool' - DERBoolean</li>
|
176
|
+
* <li>'int' - DERInteger</li>
|
177
|
+
* <li>'bitstr' - DERBitString</li>
|
178
|
+
* <li>'octstr' - DEROctetString</li>
|
179
|
+
* <li>'null' - DERNull</li>
|
180
|
+
* <li>'oid' - DERObjectIdentifier</li>
|
181
|
+
* <li>'enum' - DEREnumerated</li>
|
182
|
+
* <li>'utf8str' - DERUTF8String</li>
|
183
|
+
* <li>'numstr' - DERNumericString</li>
|
184
|
+
* <li>'prnstr' - DERPrintableString</li>
|
185
|
+
* <li>'telstr' - DERTeletexString</li>
|
186
|
+
* <li>'ia5str' - DERIA5String</li>
|
187
|
+
* <li>'utctime' - DERUTCTime</li>
|
188
|
+
* <li>'gentime' - DERGeneralizedTime</li>
|
189
|
+
* <li>'seq' - DERSequence</li>
|
190
|
+
* <li>'set' - DERSet</li>
|
191
|
+
* <li>'tag' - DERTaggedObject</li>
|
192
|
+
* </ul>
|
193
|
+
* @example
|
194
|
+
* newObject({'prnstr': 'aaa'});
|
195
|
+
* newObject({'seq': [{'int': 3}, {'prnstr': 'aaa'}]})
|
196
|
+
* // ASN.1 Tagged Object
|
197
|
+
* newObject({'tag': {'tag': 'a1',
|
198
|
+
* 'explicit': true,
|
199
|
+
* 'obj': {'seq': [{'int': 3}, {'prnstr': 'aaa'}]}}});
|
200
|
+
* // more simple representation of ASN.1 Tagged Object
|
201
|
+
* newObject({'tag': ['a1',
|
202
|
+
* true,
|
203
|
+
* {'seq': [
|
204
|
+
* {'int': 3},
|
205
|
+
* {'prnstr': 'aaa'}]}
|
206
|
+
* ]});
|
207
|
+
*/
|
208
|
+
this.newObject = function (param) {
|
209
|
+
var _KJUR = KJUR, _KJUR_asn1 = _KJUR.asn1, _DERBoolean = _KJUR_asn1.DERBoolean, _DERInteger = _KJUR_asn1.DERInteger, _DERBitString = _KJUR_asn1.DERBitString, _DEROctetString = _KJUR_asn1.DEROctetString, _DERNull = _KJUR_asn1.DERNull, _DERObjectIdentifier = _KJUR_asn1.DERObjectIdentifier, _DEREnumerated = _KJUR_asn1.DEREnumerated, _DERUTF8String = _KJUR_asn1.DERUTF8String, _DERNumericString = _KJUR_asn1.DERNumericString, _DERPrintableString = _KJUR_asn1.DERPrintableString, _DERTeletexString = _KJUR_asn1.DERTeletexString, _DERIA5String = _KJUR_asn1.DERIA5String, _DERUTCTime = _KJUR_asn1.DERUTCTime, _DERGeneralizedTime = _KJUR_asn1.DERGeneralizedTime, _DERSequence = _KJUR_asn1.DERSequence, _DERSet = _KJUR_asn1.DERSet, _DERTaggedObject = _KJUR_asn1.DERTaggedObject, _newObject = _KJUR_asn1.ASN1Util.newObject;
|
210
|
+
var keys = Object.keys(param);
|
211
|
+
if (keys.length != 1)
|
212
|
+
throw "key of param shall be only one.";
|
213
|
+
var key = keys[0];
|
214
|
+
if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + key + ":") == -1)
|
215
|
+
throw "undefined key: " + key;
|
216
|
+
if (key == "bool")
|
217
|
+
return new _DERBoolean(param[key]);
|
218
|
+
if (key == "int")
|
219
|
+
return new _DERInteger(param[key]);
|
220
|
+
if (key == "bitstr")
|
221
|
+
return new _DERBitString(param[key]);
|
222
|
+
if (key == "octstr")
|
223
|
+
return new _DEROctetString(param[key]);
|
224
|
+
if (key == "null")
|
225
|
+
return new _DERNull(param[key]);
|
226
|
+
if (key == "oid")
|
227
|
+
return new _DERObjectIdentifier(param[key]);
|
228
|
+
if (key == "enum")
|
229
|
+
return new _DEREnumerated(param[key]);
|
230
|
+
if (key == "utf8str")
|
231
|
+
return new _DERUTF8String(param[key]);
|
232
|
+
if (key == "numstr")
|
233
|
+
return new _DERNumericString(param[key]);
|
234
|
+
if (key == "prnstr")
|
235
|
+
return new _DERPrintableString(param[key]);
|
236
|
+
if (key == "telstr")
|
237
|
+
return new _DERTeletexString(param[key]);
|
238
|
+
if (key == "ia5str")
|
239
|
+
return new _DERIA5String(param[key]);
|
240
|
+
if (key == "utctime")
|
241
|
+
return new _DERUTCTime(param[key]);
|
242
|
+
if (key == "gentime")
|
243
|
+
return new _DERGeneralizedTime(param[key]);
|
244
|
+
if (key == "seq") {
|
245
|
+
var paramList = param[key];
|
246
|
+
var a = [];
|
247
|
+
for (var i = 0; i < paramList.length; i++) {
|
248
|
+
var asn1Obj = _newObject(paramList[i]);
|
249
|
+
a.push(asn1Obj);
|
250
|
+
}
|
251
|
+
return new _DERSequence({ 'array': a });
|
252
|
+
}
|
253
|
+
if (key == "set") {
|
254
|
+
var paramList = param[key];
|
255
|
+
var a = [];
|
256
|
+
for (var i = 0; i < paramList.length; i++) {
|
257
|
+
var asn1Obj = _newObject(paramList[i]);
|
258
|
+
a.push(asn1Obj);
|
259
|
+
}
|
260
|
+
return new _DERSet({ 'array': a });
|
261
|
+
}
|
262
|
+
if (key == "tag") {
|
263
|
+
var tagParam = param[key];
|
264
|
+
if (Object.prototype.toString.call(tagParam) === '[object Array]' &&
|
265
|
+
tagParam.length == 3) {
|
266
|
+
var obj = _newObject(tagParam[2]);
|
267
|
+
return new _DERTaggedObject({ tag: tagParam[0],
|
268
|
+
explicit: tagParam[1],
|
269
|
+
obj: obj });
|
270
|
+
}
|
271
|
+
else {
|
272
|
+
var newParam = {};
|
273
|
+
if (tagParam.explicit !== undefined)
|
274
|
+
newParam.explicit = tagParam.explicit;
|
275
|
+
if (tagParam.tag !== undefined)
|
276
|
+
newParam.tag = tagParam.tag;
|
277
|
+
if (tagParam.obj === undefined)
|
278
|
+
throw "obj shall be specified for 'tag'.";
|
279
|
+
newParam.obj = _newObject(tagParam.obj);
|
280
|
+
return new _DERTaggedObject(newParam);
|
281
|
+
}
|
282
|
+
}
|
283
|
+
};
|
284
|
+
/**
|
285
|
+
* get encoded hexadecimal string of ASN1Object specifed by JSON parameters
|
286
|
+
* @name jsonToASN1HEX
|
287
|
+
* @memberOf KJUR.asn1.ASN1Util
|
288
|
+
* @function
|
289
|
+
* @param {Array} param JSON parameter to generate ASN1Object
|
290
|
+
* @return hexadecimal string of ASN1Object
|
291
|
+
* @since asn1 1.0.4
|
292
|
+
* @description
|
293
|
+
* As for ASN.1 object representation of JSON object,
|
294
|
+
* please see {@link newObject}.
|
295
|
+
* @example
|
296
|
+
* jsonToASN1HEX({'prnstr': 'aaa'});
|
297
|
+
*/
|
298
|
+
this.jsonToASN1HEX = function (param) {
|
299
|
+
var asn1Obj = this.newObject(param);
|
300
|
+
return asn1Obj.getEncodedHex();
|
301
|
+
};
|
302
|
+
};
|
303
|
+
/**
|
304
|
+
* get dot noted oid number string from hexadecimal value of OID
|
305
|
+
* @name oidHexToInt
|
306
|
+
* @memberOf KJUR.asn1.ASN1Util
|
307
|
+
* @function
|
308
|
+
* @param {String} hex hexadecimal value of object identifier
|
309
|
+
* @return {String} dot noted string of object identifier
|
310
|
+
* @since jsrsasign 4.8.3 asn1 1.0.7
|
311
|
+
* @description
|
312
|
+
* This static method converts from hexadecimal string representation of
|
313
|
+
* ASN.1 value of object identifier to oid number string.
|
314
|
+
* @example
|
315
|
+
* KJUR.asn1.ASN1Util.oidHexToInt('550406') → "2.5.4.6"
|
316
|
+
*/
|
317
|
+
KJUR.asn1.ASN1Util.oidHexToInt = function (hex) {
|
318
|
+
var s = "";
|
319
|
+
var i01 = parseInt(hex.substr(0, 2), 16);
|
320
|
+
var i0 = Math.floor(i01 / 40);
|
321
|
+
var i1 = i01 % 40;
|
322
|
+
var s = i0 + "." + i1;
|
323
|
+
var binbuf = "";
|
324
|
+
for (var i = 2; i < hex.length; i += 2) {
|
325
|
+
var value = parseInt(hex.substr(i, 2), 16);
|
326
|
+
var bin = ("00000000" + value.toString(2)).slice(-8);
|
327
|
+
binbuf = binbuf + bin.substr(1, 7);
|
328
|
+
if (bin.substr(0, 1) == "0") {
|
329
|
+
var bi = new BigInteger(binbuf, 2);
|
330
|
+
s = s + "." + bi.toString(10);
|
331
|
+
binbuf = "";
|
332
|
+
}
|
333
|
+
}
|
334
|
+
;
|
335
|
+
return s;
|
336
|
+
};
|
337
|
+
/**
|
338
|
+
* get hexadecimal value of object identifier from dot noted oid value
|
339
|
+
* @name oidIntToHex
|
340
|
+
* @memberOf KJUR.asn1.ASN1Util
|
341
|
+
* @function
|
342
|
+
* @param {String} oidString dot noted string of object identifier
|
343
|
+
* @return {String} hexadecimal value of object identifier
|
344
|
+
* @since jsrsasign 4.8.3 asn1 1.0.7
|
345
|
+
* @description
|
346
|
+
* This static method converts from object identifier value string.
|
347
|
+
* to hexadecimal string representation of it.
|
348
|
+
* @example
|
349
|
+
* KJUR.asn1.ASN1Util.oidIntToHex("2.5.4.6") → "550406"
|
350
|
+
*/
|
351
|
+
KJUR.asn1.ASN1Util.oidIntToHex = function (oidString) {
|
352
|
+
var itox = function (i) {
|
353
|
+
var h = i.toString(16);
|
354
|
+
if (h.length == 1)
|
355
|
+
h = '0' + h;
|
356
|
+
return h;
|
357
|
+
};
|
358
|
+
var roidtox = function (roid) {
|
359
|
+
var h = '';
|
360
|
+
var bi = new BigInteger(roid, 10);
|
361
|
+
var b = bi.toString(2);
|
362
|
+
var padLen = 7 - b.length % 7;
|
363
|
+
if (padLen == 7)
|
364
|
+
padLen = 0;
|
365
|
+
var bPad = '';
|
366
|
+
for (var i = 0; i < padLen; i++)
|
367
|
+
bPad += '0';
|
368
|
+
b = bPad + b;
|
369
|
+
for (var i = 0; i < b.length - 1; i += 7) {
|
370
|
+
var b8 = b.substr(i, 7);
|
371
|
+
if (i != b.length - 7)
|
372
|
+
b8 = '1' + b8;
|
373
|
+
h += itox(parseInt(b8, 2));
|
374
|
+
}
|
375
|
+
return h;
|
376
|
+
};
|
377
|
+
if (!oidString.match(/^[0-9.]+$/)) {
|
378
|
+
throw "malformed oid string: " + oidString;
|
379
|
+
}
|
380
|
+
var h = '';
|
381
|
+
var a = oidString.split('.');
|
382
|
+
var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);
|
383
|
+
h += itox(i0);
|
384
|
+
a.splice(0, 2);
|
385
|
+
for (var i = 0; i < a.length; i++) {
|
386
|
+
h += roidtox(a[i]);
|
387
|
+
}
|
388
|
+
return h;
|
389
|
+
};
|
390
|
+
// ********************************************************************
|
391
|
+
// Abstract ASN.1 Classes
|
392
|
+
// ********************************************************************
|
393
|
+
// ********************************************************************
|
394
|
+
/**
|
395
|
+
* base class for ASN.1 DER encoder object
|
396
|
+
* @name KJUR.asn1.ASN1Object
|
397
|
+
* @class base class for ASN.1 DER encoder object
|
398
|
+
* @property {Boolean} isModified flag whether internal data was changed
|
399
|
+
* @property {String} hTLV hexadecimal string of ASN.1 TLV
|
400
|
+
* @property {String} hT hexadecimal string of ASN.1 TLV tag(T)
|
401
|
+
* @property {String} hL hexadecimal string of ASN.1 TLV length(L)
|
402
|
+
* @property {String} hV hexadecimal string of ASN.1 TLV value(V)
|
403
|
+
* @description
|
404
|
+
*/
|
405
|
+
KJUR.asn1.ASN1Object = function () {
|
406
|
+
var isModified = true;
|
407
|
+
var hTLV = null;
|
408
|
+
var hT = '00';
|
409
|
+
var hL = '00';
|
410
|
+
var hV = '';
|
411
|
+
/**
|
412
|
+
* get hexadecimal ASN.1 TLV length(L) bytes from TLV value(V)
|
413
|
+
* @name getLengthHexFromValue
|
414
|
+
* @memberOf KJUR.asn1.ASN1Object#
|
415
|
+
* @function
|
416
|
+
* @return {String} hexadecimal string of ASN.1 TLV length(L)
|
417
|
+
*/
|
418
|
+
this.getLengthHexFromValue = function () {
|
419
|
+
if (typeof this.hV == "undefined" || this.hV == null) {
|
420
|
+
throw "this.hV is null or undefined.";
|
421
|
+
}
|
422
|
+
if (this.hV.length % 2 == 1) {
|
423
|
+
throw "value hex must be even length: n=" + hV.length + ",v=" + this.hV;
|
424
|
+
}
|
425
|
+
var n = this.hV.length / 2;
|
426
|
+
var hN = n.toString(16);
|
427
|
+
if (hN.length % 2 == 1) {
|
428
|
+
hN = "0" + hN;
|
429
|
+
}
|
430
|
+
if (n < 128) {
|
431
|
+
return hN;
|
432
|
+
}
|
433
|
+
else {
|
434
|
+
var hNlen = hN.length / 2;
|
435
|
+
if (hNlen > 15) {
|
436
|
+
throw "ASN.1 length too long to represent by 8x: n = " + n.toString(16);
|
437
|
+
}
|
438
|
+
var head = 128 + hNlen;
|
439
|
+
return head.toString(16) + hN;
|
440
|
+
}
|
441
|
+
};
|
442
|
+
/**
|
443
|
+
* get hexadecimal string of ASN.1 TLV bytes
|
444
|
+
* @name getEncodedHex
|
445
|
+
* @memberOf KJUR.asn1.ASN1Object#
|
446
|
+
* @function
|
447
|
+
* @return {String} hexadecimal string of ASN.1 TLV
|
448
|
+
*/
|
449
|
+
this.getEncodedHex = function () {
|
450
|
+
if (this.hTLV == null || this.isModified) {
|
451
|
+
this.hV = this.getFreshValueHex();
|
452
|
+
this.hL = this.getLengthHexFromValue();
|
453
|
+
this.hTLV = this.hT + this.hL + this.hV;
|
454
|
+
this.isModified = false;
|
455
|
+
//alert("first time: " + this.hTLV);
|
456
|
+
}
|
457
|
+
return this.hTLV;
|
458
|
+
};
|
459
|
+
/**
|
460
|
+
* get hexadecimal string of ASN.1 TLV value(V) bytes
|
461
|
+
* @name getValueHex
|
462
|
+
* @memberOf KJUR.asn1.ASN1Object#
|
463
|
+
* @function
|
464
|
+
* @return {String} hexadecimal string of ASN.1 TLV value(V) bytes
|
465
|
+
*/
|
466
|
+
this.getValueHex = function () {
|
467
|
+
this.getEncodedHex();
|
468
|
+
return this.hV;
|
469
|
+
};
|
470
|
+
this.getFreshValueHex = function () {
|
471
|
+
return '';
|
472
|
+
};
|
473
|
+
};
|
474
|
+
// == BEGIN DERAbstractString ================================================
|
475
|
+
/**
|
476
|
+
* base class for ASN.1 DER string classes
|
477
|
+
* @name KJUR.asn1.DERAbstractString
|
478
|
+
* @class base class for ASN.1 DER string classes
|
479
|
+
* @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
|
480
|
+
* @property {String} s internal string of value
|
481
|
+
* @extends KJUR.asn1.ASN1Object
|
482
|
+
* @description
|
483
|
+
* <br/>
|
484
|
+
* As for argument 'params' for constructor, you can specify one of
|
485
|
+
* following properties:
|
486
|
+
* <ul>
|
487
|
+
* <li>str - specify initial ASN.1 value(V) by a string</li>
|
488
|
+
* <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
|
489
|
+
* </ul>
|
490
|
+
* NOTE: 'params' can be omitted.
|
491
|
+
*/
|
492
|
+
KJUR.asn1.DERAbstractString = function (params) {
|
493
|
+
KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
|
494
|
+
var s = null;
|
495
|
+
var hV = null;
|
496
|
+
/**
|
497
|
+
* get string value of this string object
|
498
|
+
* @name getString
|
499
|
+
* @memberOf KJUR.asn1.DERAbstractString#
|
500
|
+
* @function
|
501
|
+
* @return {String} string value of this string object
|
502
|
+
*/
|
503
|
+
this.getString = function () {
|
504
|
+
return this.s;
|
505
|
+
};
|
506
|
+
/**
|
507
|
+
* set value by a string
|
508
|
+
* @name setString
|
509
|
+
* @memberOf KJUR.asn1.DERAbstractString#
|
510
|
+
* @function
|
511
|
+
* @param {String} newS value by a string to set
|
512
|
+
*/
|
513
|
+
this.setString = function (newS) {
|
514
|
+
this.hTLV = null;
|
515
|
+
this.isModified = true;
|
516
|
+
this.s = newS;
|
517
|
+
this.hV = stohex(this.s);
|
518
|
+
};
|
519
|
+
/**
|
520
|
+
* set value by a hexadecimal string
|
521
|
+
* @name setStringHex
|
522
|
+
* @memberOf KJUR.asn1.DERAbstractString#
|
523
|
+
* @function
|
524
|
+
* @param {String} newHexString value by a hexadecimal string to set
|
525
|
+
*/
|
526
|
+
this.setStringHex = function (newHexString) {
|
527
|
+
this.hTLV = null;
|
528
|
+
this.isModified = true;
|
529
|
+
this.s = null;
|
530
|
+
this.hV = newHexString;
|
531
|
+
};
|
532
|
+
this.getFreshValueHex = function () {
|
533
|
+
return this.hV;
|
534
|
+
};
|
535
|
+
if (typeof params != "undefined") {
|
536
|
+
if (typeof params == "string") {
|
537
|
+
this.setString(params);
|
538
|
+
}
|
539
|
+
else if (typeof params['str'] != "undefined") {
|
540
|
+
this.setString(params['str']);
|
541
|
+
}
|
542
|
+
else if (typeof params['hex'] != "undefined") {
|
543
|
+
this.setStringHex(params['hex']);
|
544
|
+
}
|
545
|
+
}
|
546
|
+
};
|
547
|
+
YAHOO.lang.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);
|
548
|
+
// == END DERAbstractString ================================================
|
549
|
+
// == BEGIN DERAbstractTime ==================================================
|
550
|
+
/**
|
551
|
+
* base class for ASN.1 DER Generalized/UTCTime class
|
552
|
+
* @name KJUR.asn1.DERAbstractTime
|
553
|
+
* @class base class for ASN.1 DER Generalized/UTCTime class
|
554
|
+
* @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})
|
555
|
+
* @extends KJUR.asn1.ASN1Object
|
556
|
+
* @description
|
557
|
+
* @see KJUR.asn1.ASN1Object - superclass
|
558
|
+
*/
|
559
|
+
KJUR.asn1.DERAbstractTime = function (params) {
|
560
|
+
KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);
|
561
|
+
var s = null;
|
562
|
+
var date = null;
|
563
|
+
// --- PRIVATE METHODS --------------------
|
564
|
+
this.localDateToUTC = function (d) {
|
565
|
+
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
|
566
|
+
var utcDate = new Date(utc);
|
567
|
+
return utcDate;
|
568
|
+
};
|
569
|
+
/*
|
570
|
+
* format date string by Data object
|
571
|
+
* @name formatDate
|
572
|
+
* @memberOf KJUR.asn1.AbstractTime;
|
573
|
+
* @param {Date} dateObject
|
574
|
+
* @param {string} type 'utc' or 'gen'
|
575
|
+
* @param {boolean} withMillis flag for with millisections or not
|
576
|
+
* @description
|
577
|
+
* 'withMillis' flag is supported from asn1 1.0.6.
|
578
|
+
*/
|
579
|
+
this.formatDate = function (dateObject, type, withMillis) {
|
580
|
+
var pad = this.zeroPadding;
|
581
|
+
var d = this.localDateToUTC(dateObject);
|
582
|
+
var year = String(d.getFullYear());
|
583
|
+
if (type == 'utc')
|
584
|
+
year = year.substr(2, 2);
|
585
|
+
var month = pad(String(d.getMonth() + 1), 2);
|
586
|
+
var day = pad(String(d.getDate()), 2);
|
587
|
+
var hour = pad(String(d.getHours()), 2);
|
588
|
+
var min = pad(String(d.getMinutes()), 2);
|
589
|
+
var sec = pad(String(d.getSeconds()), 2);
|
590
|
+
var s = year + month + day + hour + min + sec;
|
591
|
+
if (withMillis === true) {
|
592
|
+
var millis = d.getMilliseconds();
|
593
|
+
if (millis != 0) {
|
594
|
+
var sMillis = pad(String(millis), 3);
|
595
|
+
sMillis = sMillis.replace(/[0]+$/, "");
|
596
|
+
s = s + "." + sMillis;
|
597
|
+
}
|
598
|
+
}
|
599
|
+
return s + "Z";
|
600
|
+
};
|
601
|
+
this.zeroPadding = function (s, len) {
|
602
|
+
if (s.length >= len)
|
603
|
+
return s;
|
604
|
+
return new Array(len - s.length + 1).join('0') + s;
|
605
|
+
};
|
606
|
+
// --- PUBLIC METHODS --------------------
|
607
|
+
/**
|
608
|
+
* get string value of this string object
|
609
|
+
* @name getString
|
610
|
+
* @memberOf KJUR.asn1.DERAbstractTime#
|
611
|
+
* @function
|
612
|
+
* @return {String} string value of this time object
|
613
|
+
*/
|
614
|
+
this.getString = function () {
|
615
|
+
return this.s;
|
616
|
+
};
|
617
|
+
/**
|
618
|
+
* set value by a string
|
619
|
+
* @name setString
|
620
|
+
* @memberOf KJUR.asn1.DERAbstractTime#
|
621
|
+
* @function
|
622
|
+
* @param {String} newS value by a string to set such like "130430235959Z"
|
623
|
+
*/
|
624
|
+
this.setString = function (newS) {
|
625
|
+
this.hTLV = null;
|
626
|
+
this.isModified = true;
|
627
|
+
this.s = newS;
|
628
|
+
this.hV = stohex(newS);
|
629
|
+
};
|
630
|
+
/**
|
631
|
+
* set value by a Date object
|
632
|
+
* @name setByDateValue
|
633
|
+
* @memberOf KJUR.asn1.DERAbstractTime#
|
634
|
+
* @function
|
635
|
+
* @param {Integer} year year of date (ex. 2013)
|
636
|
+
* @param {Integer} month month of date between 1 and 12 (ex. 12)
|
637
|
+
* @param {Integer} day day of month
|
638
|
+
* @param {Integer} hour hours of date
|
639
|
+
* @param {Integer} min minutes of date
|
640
|
+
* @param {Integer} sec seconds of date
|
641
|
+
*/
|
642
|
+
this.setByDateValue = function (year, month, day, hour, min, sec) {
|
643
|
+
var dateObject = new Date(Date.UTC(year, month - 1, day, hour, min, sec, 0));
|
644
|
+
this.setByDate(dateObject);
|
645
|
+
};
|
646
|
+
this.getFreshValueHex = function () {
|
647
|
+
return this.hV;
|
648
|
+
};
|
649
|
+
};
|
650
|
+
YAHOO.lang.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);
|
651
|
+
// == END DERAbstractTime ==================================================
|
652
|
+
// == BEGIN DERAbstractStructured ============================================
|
653
|
+
/**
|
654
|
+
* base class for ASN.1 DER structured class
|
655
|
+
* @name KJUR.asn1.DERAbstractStructured
|
656
|
+
* @class base class for ASN.1 DER structured class
|
657
|
+
* @property {Array} asn1Array internal array of ASN1Object
|
658
|
+
* @extends KJUR.asn1.ASN1Object
|
659
|
+
* @description
|
660
|
+
* @see KJUR.asn1.ASN1Object - superclass
|
661
|
+
*/
|
662
|
+
KJUR.asn1.DERAbstractStructured = function (params) {
|
663
|
+
KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
|
664
|
+
var asn1Array = null;
|
665
|
+
/**
|
666
|
+
* set value by array of ASN1Object
|
667
|
+
* @name setByASN1ObjectArray
|
668
|
+
* @memberOf KJUR.asn1.DERAbstractStructured#
|
669
|
+
* @function
|
670
|
+
* @param {array} asn1ObjectArray array of ASN1Object to set
|
671
|
+
*/
|
672
|
+
this.setByASN1ObjectArray = function (asn1ObjectArray) {
|
673
|
+
this.hTLV = null;
|
674
|
+
this.isModified = true;
|
675
|
+
this.asn1Array = asn1ObjectArray;
|
676
|
+
};
|
677
|
+
/**
|
678
|
+
* append an ASN1Object to internal array
|
679
|
+
* @name appendASN1Object
|
680
|
+
* @memberOf KJUR.asn1.DERAbstractStructured#
|
681
|
+
* @function
|
682
|
+
* @param {ASN1Object} asn1Object to add
|
683
|
+
*/
|
684
|
+
this.appendASN1Object = function (asn1Object) {
|
685
|
+
this.hTLV = null;
|
686
|
+
this.isModified = true;
|
687
|
+
this.asn1Array.push(asn1Object);
|
688
|
+
};
|
689
|
+
this.asn1Array = new Array();
|
690
|
+
if (typeof params != "undefined") {
|
691
|
+
if (typeof params['array'] != "undefined") {
|
692
|
+
this.asn1Array = params['array'];
|
693
|
+
}
|
694
|
+
}
|
695
|
+
};
|
696
|
+
YAHOO.lang.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);
|
697
|
+
// ********************************************************************
|
698
|
+
// ASN.1 Object Classes
|
699
|
+
// ********************************************************************
|
700
|
+
// ********************************************************************
|
701
|
+
/**
|
702
|
+
* class for ASN.1 DER Boolean
|
703
|
+
* @name KJUR.asn1.DERBoolean
|
704
|
+
* @class class for ASN.1 DER Boolean
|
705
|
+
* @extends KJUR.asn1.ASN1Object
|
706
|
+
* @description
|
707
|
+
* @see KJUR.asn1.ASN1Object - superclass
|
708
|
+
*/
|
709
|
+
KJUR.asn1.DERBoolean = function () {
|
710
|
+
KJUR.asn1.DERBoolean.superclass.constructor.call(this);
|
711
|
+
this.hT = "01";
|
712
|
+
this.hTLV = "0101ff";
|
713
|
+
};
|
714
|
+
YAHOO.lang.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);
|
715
|
+
// ********************************************************************
|
716
|
+
/**
|
717
|
+
* class for ASN.1 DER Integer
|
718
|
+
* @name KJUR.asn1.DERInteger
|
719
|
+
* @class class for ASN.1 DER Integer
|
720
|
+
* @extends KJUR.asn1.ASN1Object
|
721
|
+
* @description
|
722
|
+
* <br/>
|
723
|
+
* As for argument 'params' for constructor, you can specify one of
|
724
|
+
* following properties:
|
725
|
+
* <ul>
|
726
|
+
* <li>int - specify initial ASN.1 value(V) by integer value</li>
|
727
|
+
* <li>bigint - specify initial ASN.1 value(V) by BigInteger object</li>
|
728
|
+
* <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
|
729
|
+
* </ul>
|
730
|
+
* NOTE: 'params' can be omitted.
|
731
|
+
*/
|
732
|
+
KJUR.asn1.DERInteger = function (params) {
|
733
|
+
KJUR.asn1.DERInteger.superclass.constructor.call(this);
|
734
|
+
this.hT = "02";
|
735
|
+
/**
|
736
|
+
* set value by Tom Wu's BigInteger object
|
737
|
+
* @name setByBigInteger
|
738
|
+
* @memberOf KJUR.asn1.DERInteger#
|
739
|
+
* @function
|
740
|
+
* @param {BigInteger} bigIntegerValue to set
|
741
|
+
*/
|
742
|
+
this.setByBigInteger = function (bigIntegerValue) {
|
743
|
+
this.hTLV = null;
|
744
|
+
this.isModified = true;
|
745
|
+
this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);
|
746
|
+
};
|
747
|
+
/**
|
748
|
+
* set value by integer value
|
749
|
+
* @name setByInteger
|
750
|
+
* @memberOf KJUR.asn1.DERInteger
|
751
|
+
* @function
|
752
|
+
* @param {Integer} integer value to set
|
753
|
+
*/
|
754
|
+
this.setByInteger = function (intValue) {
|
755
|
+
var bi = new BigInteger(String(intValue), 10);
|
756
|
+
this.setByBigInteger(bi);
|
757
|
+
};
|
758
|
+
/**
|
759
|
+
* set value by integer value
|
760
|
+
* @name setValueHex
|
761
|
+
* @memberOf KJUR.asn1.DERInteger#
|
762
|
+
* @function
|
763
|
+
* @param {String} hexadecimal string of integer value
|
764
|
+
* @description
|
765
|
+
* <br/>
|
766
|
+
* NOTE: Value shall be represented by minimum octet length of
|
767
|
+
* two's complement representation.
|
768
|
+
* @example
|
769
|
+
* new KJUR.asn1.DERInteger(123);
|
770
|
+
* new KJUR.asn1.DERInteger({'int': 123});
|
771
|
+
* new KJUR.asn1.DERInteger({'hex': '1fad'});
|
772
|
+
*/
|
773
|
+
this.setValueHex = function (newHexString) {
|
774
|
+
this.hV = newHexString;
|
775
|
+
};
|
776
|
+
this.getFreshValueHex = function () {
|
777
|
+
return this.hV;
|
778
|
+
};
|
779
|
+
if (typeof params != "undefined") {
|
780
|
+
if (typeof params['bigint'] != "undefined") {
|
781
|
+
this.setByBigInteger(params['bigint']);
|
782
|
+
}
|
783
|
+
else if (typeof params['int'] != "undefined") {
|
784
|
+
this.setByInteger(params['int']);
|
785
|
+
}
|
786
|
+
else if (typeof params == "number") {
|
787
|
+
this.setByInteger(params);
|
788
|
+
}
|
789
|
+
else if (typeof params['hex'] != "undefined") {
|
790
|
+
this.setValueHex(params['hex']);
|
791
|
+
}
|
792
|
+
}
|
793
|
+
};
|
794
|
+
YAHOO.lang.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);
|
795
|
+
// ********************************************************************
|
796
|
+
/**
|
797
|
+
* class for ASN.1 DER encoded BitString primitive
|
798
|
+
* @name KJUR.asn1.DERBitString
|
799
|
+
* @class class for ASN.1 DER encoded BitString primitive
|
800
|
+
* @extends KJUR.asn1.ASN1Object
|
801
|
+
* @description
|
802
|
+
* <br/>
|
803
|
+
* As for argument 'params' for constructor, you can specify one of
|
804
|
+
* following properties:
|
805
|
+
* <ul>
|
806
|
+
* <li>bin - specify binary string (ex. '10111')</li>
|
807
|
+
* <li>array - specify array of boolean (ex. [true,false,true,true])</li>
|
808
|
+
* <li>hex - specify hexadecimal string of ASN.1 value(V) including unused bits</li>
|
809
|
+
* <li>obj - specify {@link KJUR.asn1.ASN1Util.newObject}
|
810
|
+
* argument for "BitString encapsulates" structure.</li>
|
811
|
+
* </ul>
|
812
|
+
* NOTE1: 'params' can be omitted.<br/>
|
813
|
+
* NOTE2: 'obj' parameter have been supported since
|
814
|
+
* asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).<br/>
|
815
|
+
* @example
|
816
|
+
* // default constructor
|
817
|
+
* o = new KJUR.asn1.DERBitString();
|
818
|
+
* // initialize with binary string
|
819
|
+
* o = new KJUR.asn1.DERBitString({bin: "1011"});
|
820
|
+
* // initialize with boolean array
|
821
|
+
* o = new KJUR.asn1.DERBitString({array: [true,false,true,true]});
|
822
|
+
* // initialize with hexadecimal string (04 is unused bits)
|
823
|
+
* o = new KJUR.asn1.DEROctetString({hex: "04bac0"});
|
824
|
+
* // initialize with ASN1Util.newObject argument for encapsulated
|
825
|
+
* o = new KJUR.asn1.DERBitString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});
|
826
|
+
* // above generates a ASN.1 data like this:
|
827
|
+
* // BIT STRING, encapsulates {
|
828
|
+
* // SEQUENCE {
|
829
|
+
* // INTEGER 3
|
830
|
+
* // PrintableString 'aaa'
|
831
|
+
* // }
|
832
|
+
* // }
|
833
|
+
*/
|
834
|
+
KJUR.asn1.DERBitString = function (params) {
|
835
|
+
if (params !== undefined && typeof params.obj !== "undefined") {
|
836
|
+
var o = KJUR.asn1.ASN1Util.newObject(params.obj);
|
837
|
+
params.hex = "00" + o.getEncodedHex();
|
838
|
+
}
|
839
|
+
KJUR.asn1.DERBitString.superclass.constructor.call(this);
|
840
|
+
this.hT = "03";
|
841
|
+
/**
|
842
|
+
* set ASN.1 value(V) by a hexadecimal string including unused bits
|
843
|
+
* @name setHexValueIncludingUnusedBits
|
844
|
+
* @memberOf KJUR.asn1.DERBitString#
|
845
|
+
* @function
|
846
|
+
* @param {String} newHexStringIncludingUnusedBits
|
847
|
+
*/
|
848
|
+
this.setHexValueIncludingUnusedBits = function (newHexStringIncludingUnusedBits) {
|
849
|
+
this.hTLV = null;
|
850
|
+
this.isModified = true;
|
851
|
+
this.hV = newHexStringIncludingUnusedBits;
|
852
|
+
};
|
853
|
+
/**
|
854
|
+
* set ASN.1 value(V) by unused bit and hexadecimal string of value
|
855
|
+
* @name setUnusedBitsAndHexValue
|
856
|
+
* @memberOf KJUR.asn1.DERBitString#
|
857
|
+
* @function
|
858
|
+
* @param {Integer} unusedBits
|
859
|
+
* @param {String} hValue
|
860
|
+
*/
|
861
|
+
this.setUnusedBitsAndHexValue = function (unusedBits, hValue) {
|
862
|
+
if (unusedBits < 0 || 7 < unusedBits) {
|
863
|
+
throw "unused bits shall be from 0 to 7: u = " + unusedBits;
|
864
|
+
}
|
865
|
+
var hUnusedBits = "0" + unusedBits;
|
866
|
+
this.hTLV = null;
|
867
|
+
this.isModified = true;
|
868
|
+
this.hV = hUnusedBits + hValue;
|
869
|
+
};
|
870
|
+
/**
|
871
|
+
* set ASN.1 DER BitString by binary string<br/>
|
872
|
+
* @name setByBinaryString
|
873
|
+
* @memberOf KJUR.asn1.DERBitString#
|
874
|
+
* @function
|
875
|
+
* @param {String} binaryString binary value string (i.e. '10111')
|
876
|
+
* @description
|
877
|
+
* Its unused bits will be calculated automatically by length of
|
878
|
+
* 'binaryValue'. <br/>
|
879
|
+
* NOTE: Trailing zeros '0' will be ignored.
|
880
|
+
* @example
|
881
|
+
* o = new KJUR.asn1.DERBitString();
|
882
|
+
* o.setByBooleanArray("01011");
|
883
|
+
*/
|
884
|
+
this.setByBinaryString = function (binaryString) {
|
885
|
+
binaryString = binaryString.replace(/0+$/, '');
|
886
|
+
var unusedBits = 8 - binaryString.length % 8;
|
887
|
+
if (unusedBits == 8)
|
888
|
+
unusedBits = 0;
|
889
|
+
for (var i = 0; i <= unusedBits; i++) {
|
890
|
+
binaryString += '0';
|
891
|
+
}
|
892
|
+
var h = '';
|
893
|
+
for (var i = 0; i < binaryString.length - 1; i += 8) {
|
894
|
+
var b = binaryString.substr(i, 8);
|
895
|
+
var x = parseInt(b, 2).toString(16);
|
896
|
+
if (x.length == 1)
|
897
|
+
x = '0' + x;
|
898
|
+
h += x;
|
899
|
+
}
|
900
|
+
this.hTLV = null;
|
901
|
+
this.isModified = true;
|
902
|
+
this.hV = '0' + unusedBits + h;
|
903
|
+
};
|
904
|
+
/**
|
905
|
+
* set ASN.1 TLV value(V) by an array of boolean<br/>
|
906
|
+
* @name setByBooleanArray
|
907
|
+
* @memberOf KJUR.asn1.DERBitString#
|
908
|
+
* @function
|
909
|
+
* @param {array} booleanArray array of boolean (ex. [true, false, true])
|
910
|
+
* @description
|
911
|
+
* NOTE: Trailing falses will be ignored in the ASN.1 DER Object.
|
912
|
+
* @example
|
913
|
+
* o = new KJUR.asn1.DERBitString();
|
914
|
+
* o.setByBooleanArray([false, true, false, true, true]);
|
915
|
+
*/
|
916
|
+
this.setByBooleanArray = function (booleanArray) {
|
917
|
+
var s = '';
|
918
|
+
for (var i = 0; i < booleanArray.length; i++) {
|
919
|
+
if (booleanArray[i] == true) {
|
920
|
+
s += '1';
|
921
|
+
}
|
922
|
+
else {
|
923
|
+
s += '0';
|
924
|
+
}
|
925
|
+
}
|
926
|
+
this.setByBinaryString(s);
|
927
|
+
};
|
928
|
+
/**
|
929
|
+
* generate an array of falses with specified length<br/>
|
930
|
+
* @name newFalseArray
|
931
|
+
* @memberOf KJUR.asn1.DERBitString
|
932
|
+
* @function
|
933
|
+
* @param {Integer} nLength length of array to generate
|
934
|
+
* @return {array} array of boolean falses
|
935
|
+
* @description
|
936
|
+
* This static method may be useful to initialize boolean array.
|
937
|
+
* @example
|
938
|
+
* o = new KJUR.asn1.DERBitString();
|
939
|
+
* o.newFalseArray(3) → [false, false, false]
|
940
|
+
*/
|
941
|
+
this.newFalseArray = function (nLength) {
|
942
|
+
var a = new Array(nLength);
|
943
|
+
for (var i = 0; i < nLength; i++) {
|
944
|
+
a[i] = false;
|
945
|
+
}
|
946
|
+
return a;
|
947
|
+
};
|
948
|
+
this.getFreshValueHex = function () {
|
949
|
+
return this.hV;
|
950
|
+
};
|
951
|
+
if (typeof params != "undefined") {
|
952
|
+
if (typeof params == "string" && params.toLowerCase().match(/^[0-9a-f]+$/)) {
|
953
|
+
this.setHexValueIncludingUnusedBits(params);
|
954
|
+
}
|
955
|
+
else if (typeof params['hex'] != "undefined") {
|
956
|
+
this.setHexValueIncludingUnusedBits(params['hex']);
|
957
|
+
}
|
958
|
+
else if (typeof params['bin'] != "undefined") {
|
959
|
+
this.setByBinaryString(params['bin']);
|
960
|
+
}
|
961
|
+
else if (typeof params['array'] != "undefined") {
|
962
|
+
this.setByBooleanArray(params['array']);
|
963
|
+
}
|
964
|
+
}
|
965
|
+
};
|
966
|
+
YAHOO.lang.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);
|
967
|
+
// ********************************************************************
|
968
|
+
/**
|
969
|
+
* class for ASN.1 DER OctetString<br/>
|
970
|
+
* @name KJUR.asn1.DEROctetString
|
971
|
+
* @class class for ASN.1 DER OctetString
|
972
|
+
* @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
|
973
|
+
* @extends KJUR.asn1.DERAbstractString
|
974
|
+
* @description
|
975
|
+
* This class provides ASN.1 OctetString simple type.<br/>
|
976
|
+
* Supported "params" attributes are:
|
977
|
+
* <ul>
|
978
|
+
* <li>str - to set a string as a value</li>
|
979
|
+
* <li>hex - to set a hexadecimal string as a value</li>
|
980
|
+
* <li>obj - to set a encapsulated ASN.1 value by JSON object
|
981
|
+
* which is defined in {@link KJUR.asn1.ASN1Util.newObject}</li>
|
982
|
+
* </ul>
|
983
|
+
* NOTE: A parameter 'obj' have been supported
|
984
|
+
* for "OCTET STRING, encapsulates" structure.
|
985
|
+
* since asn1 1.0.11, jsrsasign 6.1.1 (2016-Sep-25).
|
986
|
+
* @see KJUR.asn1.DERAbstractString - superclass
|
987
|
+
* @example
|
988
|
+
* // default constructor
|
989
|
+
* o = new KJUR.asn1.DEROctetString();
|
990
|
+
* // initialize with string
|
991
|
+
* o = new KJUR.asn1.DEROctetString({str: "aaa"});
|
992
|
+
* // initialize with hexadecimal string
|
993
|
+
* o = new KJUR.asn1.DEROctetString({hex: "616161"});
|
994
|
+
* // initialize with ASN1Util.newObject argument
|
995
|
+
* o = new KJUR.asn1.DEROctetString({obj: {seq: [{int: 3}, {prnstr: 'aaa'}]}});
|
996
|
+
* // above generates a ASN.1 data like this:
|
997
|
+
* // OCTET STRING, encapsulates {
|
998
|
+
* // SEQUENCE {
|
999
|
+
* // INTEGER 3
|
1000
|
+
* // PrintableString 'aaa'
|
1001
|
+
* // }
|
1002
|
+
* // }
|
1003
|
+
*/
|
1004
|
+
KJUR.asn1.DEROctetString = function (params) {
|
1005
|
+
if (params !== undefined && typeof params.obj !== "undefined") {
|
1006
|
+
var o = KJUR.asn1.ASN1Util.newObject(params.obj);
|
1007
|
+
params.hex = o.getEncodedHex();
|
1008
|
+
}
|
1009
|
+
KJUR.asn1.DEROctetString.superclass.constructor.call(this, params);
|
1010
|
+
this.hT = "04";
|
1011
|
+
};
|
1012
|
+
YAHOO.lang.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);
|
1013
|
+
// ********************************************************************
|
1014
|
+
/**
|
1015
|
+
* class for ASN.1 DER Null
|
1016
|
+
* @name KJUR.asn1.DERNull
|
1017
|
+
* @class class for ASN.1 DER Null
|
1018
|
+
* @extends KJUR.asn1.ASN1Object
|
1019
|
+
* @description
|
1020
|
+
* @see KJUR.asn1.ASN1Object - superclass
|
1021
|
+
*/
|
1022
|
+
KJUR.asn1.DERNull = function () {
|
1023
|
+
KJUR.asn1.DERNull.superclass.constructor.call(this);
|
1024
|
+
this.hT = "05";
|
1025
|
+
this.hTLV = "0500";
|
1026
|
+
};
|
1027
|
+
YAHOO.lang.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);
|
1028
|
+
// ********************************************************************
|
1029
|
+
/**
|
1030
|
+
* class for ASN.1 DER ObjectIdentifier
|
1031
|
+
* @name KJUR.asn1.DERObjectIdentifier
|
1032
|
+
* @class class for ASN.1 DER ObjectIdentifier
|
1033
|
+
* @param {Array} params associative array of parameters (ex. {'oid': '2.5.4.5'})
|
1034
|
+
* @extends KJUR.asn1.ASN1Object
|
1035
|
+
* @description
|
1036
|
+
* <br/>
|
1037
|
+
* As for argument 'params' for constructor, you can specify one of
|
1038
|
+
* following properties:
|
1039
|
+
* <ul>
|
1040
|
+
* <li>oid - specify initial ASN.1 value(V) by a oid string (ex. 2.5.4.13)</li>
|
1041
|
+
* <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
|
1042
|
+
* </ul>
|
1043
|
+
* NOTE: 'params' can be omitted.
|
1044
|
+
*/
|
1045
|
+
KJUR.asn1.DERObjectIdentifier = function (params) {
|
1046
|
+
var itox = function (i) {
|
1047
|
+
var h = i.toString(16);
|
1048
|
+
if (h.length == 1)
|
1049
|
+
h = '0' + h;
|
1050
|
+
return h;
|
1051
|
+
};
|
1052
|
+
var roidtox = function (roid) {
|
1053
|
+
var h = '';
|
1054
|
+
var bi = new BigInteger(roid, 10);
|
1055
|
+
var b = bi.toString(2);
|
1056
|
+
var padLen = 7 - b.length % 7;
|
1057
|
+
if (padLen == 7)
|
1058
|
+
padLen = 0;
|
1059
|
+
var bPad = '';
|
1060
|
+
for (var i = 0; i < padLen; i++)
|
1061
|
+
bPad += '0';
|
1062
|
+
b = bPad + b;
|
1063
|
+
for (var i = 0; i < b.length - 1; i += 7) {
|
1064
|
+
var b8 = b.substr(i, 7);
|
1065
|
+
if (i != b.length - 7)
|
1066
|
+
b8 = '1' + b8;
|
1067
|
+
h += itox(parseInt(b8, 2));
|
1068
|
+
}
|
1069
|
+
return h;
|
1070
|
+
};
|
1071
|
+
KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);
|
1072
|
+
this.hT = "06";
|
1073
|
+
/**
|
1074
|
+
* set value by a hexadecimal string
|
1075
|
+
* @name setValueHex
|
1076
|
+
* @memberOf KJUR.asn1.DERObjectIdentifier#
|
1077
|
+
* @function
|
1078
|
+
* @param {String} newHexString hexadecimal value of OID bytes
|
1079
|
+
*/
|
1080
|
+
this.setValueHex = function (newHexString) {
|
1081
|
+
this.hTLV = null;
|
1082
|
+
this.isModified = true;
|
1083
|
+
this.s = null;
|
1084
|
+
this.hV = newHexString;
|
1085
|
+
};
|
1086
|
+
/**
|
1087
|
+
* set value by a OID string<br/>
|
1088
|
+
* @name setValueOidString
|
1089
|
+
* @memberOf KJUR.asn1.DERObjectIdentifier#
|
1090
|
+
* @function
|
1091
|
+
* @param {String} oidString OID string (ex. 2.5.4.13)
|
1092
|
+
* @example
|
1093
|
+
* o = new KJUR.asn1.DERObjectIdentifier();
|
1094
|
+
* o.setValueOidString("2.5.4.13");
|
1095
|
+
*/
|
1096
|
+
this.setValueOidString = function (oidString) {
|
1097
|
+
if (!oidString.match(/^[0-9.]+$/)) {
|
1098
|
+
throw "malformed oid string: " + oidString;
|
1099
|
+
}
|
1100
|
+
var h = '';
|
1101
|
+
var a = oidString.split('.');
|
1102
|
+
var i0 = parseInt(a[0]) * 40 + parseInt(a[1]);
|
1103
|
+
h += itox(i0);
|
1104
|
+
a.splice(0, 2);
|
1105
|
+
for (var i = 0; i < a.length; i++) {
|
1106
|
+
h += roidtox(a[i]);
|
1107
|
+
}
|
1108
|
+
this.hTLV = null;
|
1109
|
+
this.isModified = true;
|
1110
|
+
this.s = null;
|
1111
|
+
this.hV = h;
|
1112
|
+
};
|
1113
|
+
/**
|
1114
|
+
* set value by a OID name
|
1115
|
+
* @name setValueName
|
1116
|
+
* @memberOf KJUR.asn1.DERObjectIdentifier#
|
1117
|
+
* @function
|
1118
|
+
* @param {String} oidName OID name (ex. 'serverAuth')
|
1119
|
+
* @since 1.0.1
|
1120
|
+
* @description
|
1121
|
+
* OID name shall be defined in 'KJUR.asn1.x509.OID.name2oidList'.
|
1122
|
+
* Otherwise raise error.
|
1123
|
+
* @example
|
1124
|
+
* o = new KJUR.asn1.DERObjectIdentifier();
|
1125
|
+
* o.setValueName("serverAuth");
|
1126
|
+
*/
|
1127
|
+
this.setValueName = function (oidName) {
|
1128
|
+
var oid = KJUR.asn1.x509.OID.name2oid(oidName);
|
1129
|
+
if (oid !== '') {
|
1130
|
+
this.setValueOidString(oid);
|
1131
|
+
}
|
1132
|
+
else {
|
1133
|
+
throw "DERObjectIdentifier oidName undefined: " + oidName;
|
1134
|
+
}
|
1135
|
+
};
|
1136
|
+
this.getFreshValueHex = function () {
|
1137
|
+
return this.hV;
|
1138
|
+
};
|
1139
|
+
if (params !== undefined) {
|
1140
|
+
if (typeof params === "string") {
|
1141
|
+
if (params.match(/^[0-2].[0-9.]+$/)) {
|
1142
|
+
this.setValueOidString(params);
|
1143
|
+
}
|
1144
|
+
else {
|
1145
|
+
this.setValueName(params);
|
1146
|
+
}
|
1147
|
+
}
|
1148
|
+
else if (params.oid !== undefined) {
|
1149
|
+
this.setValueOidString(params.oid);
|
1150
|
+
}
|
1151
|
+
else if (params.hex !== undefined) {
|
1152
|
+
this.setValueHex(params.hex);
|
1153
|
+
}
|
1154
|
+
else if (params.name !== undefined) {
|
1155
|
+
this.setValueName(params.name);
|
1156
|
+
}
|
1157
|
+
}
|
1158
|
+
};
|
1159
|
+
YAHOO.lang.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);
|
1160
|
+
// ********************************************************************
|
1161
|
+
/**
|
1162
|
+
* class for ASN.1 DER Enumerated
|
1163
|
+
* @name KJUR.asn1.DEREnumerated
|
1164
|
+
* @class class for ASN.1 DER Enumerated
|
1165
|
+
* @extends KJUR.asn1.ASN1Object
|
1166
|
+
* @description
|
1167
|
+
* <br/>
|
1168
|
+
* As for argument 'params' for constructor, you can specify one of
|
1169
|
+
* following properties:
|
1170
|
+
* <ul>
|
1171
|
+
* <li>int - specify initial ASN.1 value(V) by integer value</li>
|
1172
|
+
* <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
|
1173
|
+
* </ul>
|
1174
|
+
* NOTE: 'params' can be omitted.
|
1175
|
+
* @example
|
1176
|
+
* new KJUR.asn1.DEREnumerated(123);
|
1177
|
+
* new KJUR.asn1.DEREnumerated({int: 123});
|
1178
|
+
* new KJUR.asn1.DEREnumerated({hex: '1fad'});
|
1179
|
+
*/
|
1180
|
+
KJUR.asn1.DEREnumerated = function (params) {
|
1181
|
+
KJUR.asn1.DEREnumerated.superclass.constructor.call(this);
|
1182
|
+
this.hT = "0a";
|
1183
|
+
/**
|
1184
|
+
* set value by Tom Wu's BigInteger object
|
1185
|
+
* @name setByBigInteger
|
1186
|
+
* @memberOf KJUR.asn1.DEREnumerated#
|
1187
|
+
* @function
|
1188
|
+
* @param {BigInteger} bigIntegerValue to set
|
1189
|
+
*/
|
1190
|
+
this.setByBigInteger = function (bigIntegerValue) {
|
1191
|
+
this.hTLV = null;
|
1192
|
+
this.isModified = true;
|
1193
|
+
this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(bigIntegerValue);
|
1194
|
+
};
|
1195
|
+
/**
|
1196
|
+
* set value by integer value
|
1197
|
+
* @name setByInteger
|
1198
|
+
* @memberOf KJUR.asn1.DEREnumerated#
|
1199
|
+
* @function
|
1200
|
+
* @param {Integer} integer value to set
|
1201
|
+
*/
|
1202
|
+
this.setByInteger = function (intValue) {
|
1203
|
+
var bi = new BigInteger(String(intValue), 10);
|
1204
|
+
this.setByBigInteger(bi);
|
1205
|
+
};
|
1206
|
+
/**
|
1207
|
+
* set value by integer value
|
1208
|
+
* @name setValueHex
|
1209
|
+
* @memberOf KJUR.asn1.DEREnumerated#
|
1210
|
+
* @function
|
1211
|
+
* @param {String} hexadecimal string of integer value
|
1212
|
+
* @description
|
1213
|
+
* <br/>
|
1214
|
+
* NOTE: Value shall be represented by minimum octet length of
|
1215
|
+
* two's complement representation.
|
1216
|
+
*/
|
1217
|
+
this.setValueHex = function (newHexString) {
|
1218
|
+
this.hV = newHexString;
|
1219
|
+
};
|
1220
|
+
this.getFreshValueHex = function () {
|
1221
|
+
return this.hV;
|
1222
|
+
};
|
1223
|
+
if (typeof params != "undefined") {
|
1224
|
+
if (typeof params['int'] != "undefined") {
|
1225
|
+
this.setByInteger(params['int']);
|
1226
|
+
}
|
1227
|
+
else if (typeof params == "number") {
|
1228
|
+
this.setByInteger(params);
|
1229
|
+
}
|
1230
|
+
else if (typeof params['hex'] != "undefined") {
|
1231
|
+
this.setValueHex(params['hex']);
|
1232
|
+
}
|
1233
|
+
}
|
1234
|
+
};
|
1235
|
+
YAHOO.lang.extend(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object);
|
1236
|
+
// ********************************************************************
|
1237
|
+
/**
|
1238
|
+
* class for ASN.1 DER UTF8String
|
1239
|
+
* @name KJUR.asn1.DERUTF8String
|
1240
|
+
* @class class for ASN.1 DER UTF8String
|
1241
|
+
* @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
|
1242
|
+
* @extends KJUR.asn1.DERAbstractString
|
1243
|
+
* @description
|
1244
|
+
* @see KJUR.asn1.DERAbstractString - superclass
|
1245
|
+
*/
|
1246
|
+
KJUR.asn1.DERUTF8String = function (params) {
|
1247
|
+
KJUR.asn1.DERUTF8String.superclass.constructor.call(this, params);
|
1248
|
+
this.hT = "0c";
|
1249
|
+
};
|
1250
|
+
YAHOO.lang.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);
|
1251
|
+
// ********************************************************************
|
1252
|
+
/**
|
1253
|
+
* class for ASN.1 DER NumericString
|
1254
|
+
* @name KJUR.asn1.DERNumericString
|
1255
|
+
* @class class for ASN.1 DER NumericString
|
1256
|
+
* @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
|
1257
|
+
* @extends KJUR.asn1.DERAbstractString
|
1258
|
+
* @description
|
1259
|
+
* @see KJUR.asn1.DERAbstractString - superclass
|
1260
|
+
*/
|
1261
|
+
KJUR.asn1.DERNumericString = function (params) {
|
1262
|
+
KJUR.asn1.DERNumericString.superclass.constructor.call(this, params);
|
1263
|
+
this.hT = "12";
|
1264
|
+
};
|
1265
|
+
YAHOO.lang.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);
|
1266
|
+
// ********************************************************************
|
1267
|
+
/**
|
1268
|
+
* class for ASN.1 DER PrintableString
|
1269
|
+
* @name KJUR.asn1.DERPrintableString
|
1270
|
+
* @class class for ASN.1 DER PrintableString
|
1271
|
+
* @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
|
1272
|
+
* @extends KJUR.asn1.DERAbstractString
|
1273
|
+
* @description
|
1274
|
+
* @see KJUR.asn1.DERAbstractString - superclass
|
1275
|
+
*/
|
1276
|
+
KJUR.asn1.DERPrintableString = function (params) {
|
1277
|
+
KJUR.asn1.DERPrintableString.superclass.constructor.call(this, params);
|
1278
|
+
this.hT = "13";
|
1279
|
+
};
|
1280
|
+
YAHOO.lang.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);
|
1281
|
+
// ********************************************************************
|
1282
|
+
/**
|
1283
|
+
* class for ASN.1 DER TeletexString
|
1284
|
+
* @name KJUR.asn1.DERTeletexString
|
1285
|
+
* @class class for ASN.1 DER TeletexString
|
1286
|
+
* @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
|
1287
|
+
* @extends KJUR.asn1.DERAbstractString
|
1288
|
+
* @description
|
1289
|
+
* @see KJUR.asn1.DERAbstractString - superclass
|
1290
|
+
*/
|
1291
|
+
KJUR.asn1.DERTeletexString = function (params) {
|
1292
|
+
KJUR.asn1.DERTeletexString.superclass.constructor.call(this, params);
|
1293
|
+
this.hT = "14";
|
1294
|
+
};
|
1295
|
+
YAHOO.lang.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);
|
1296
|
+
// ********************************************************************
|
1297
|
+
/**
|
1298
|
+
* class for ASN.1 DER IA5String
|
1299
|
+
* @name KJUR.asn1.DERIA5String
|
1300
|
+
* @class class for ASN.1 DER IA5String
|
1301
|
+
* @param {Array} params associative array of parameters (ex. {'str': 'aaa'})
|
1302
|
+
* @extends KJUR.asn1.DERAbstractString
|
1303
|
+
* @description
|
1304
|
+
* @see KJUR.asn1.DERAbstractString - superclass
|
1305
|
+
*/
|
1306
|
+
KJUR.asn1.DERIA5String = function (params) {
|
1307
|
+
KJUR.asn1.DERIA5String.superclass.constructor.call(this, params);
|
1308
|
+
this.hT = "16";
|
1309
|
+
};
|
1310
|
+
YAHOO.lang.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);
|
1311
|
+
// ********************************************************************
|
1312
|
+
/**
|
1313
|
+
* class for ASN.1 DER UTCTime
|
1314
|
+
* @name KJUR.asn1.DERUTCTime
|
1315
|
+
* @class class for ASN.1 DER UTCTime
|
1316
|
+
* @param {Array} params associative array of parameters (ex. {'str': '130430235959Z'})
|
1317
|
+
* @extends KJUR.asn1.DERAbstractTime
|
1318
|
+
* @description
|
1319
|
+
* <br/>
|
1320
|
+
* As for argument 'params' for constructor, you can specify one of
|
1321
|
+
* following properties:
|
1322
|
+
* <ul>
|
1323
|
+
* <li>str - specify initial ASN.1 value(V) by a string (ex.'130430235959Z')</li>
|
1324
|
+
* <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
|
1325
|
+
* <li>date - specify Date object.</li>
|
1326
|
+
* </ul>
|
1327
|
+
* NOTE: 'params' can be omitted.
|
1328
|
+
* <h4>EXAMPLES</h4>
|
1329
|
+
* @example
|
1330
|
+
* d1 = new KJUR.asn1.DERUTCTime();
|
1331
|
+
* d1.setString('130430125959Z');
|
1332
|
+
*
|
1333
|
+
* d2 = new KJUR.asn1.DERUTCTime({'str': '130430125959Z'});
|
1334
|
+
* d3 = new KJUR.asn1.DERUTCTime({'date': new Date(Date.UTC(2015, 0, 31, 0, 0, 0, 0))});
|
1335
|
+
* d4 = new KJUR.asn1.DERUTCTime('130430125959Z');
|
1336
|
+
*/
|
1337
|
+
KJUR.asn1.DERUTCTime = function (params) {
|
1338
|
+
KJUR.asn1.DERUTCTime.superclass.constructor.call(this, params);
|
1339
|
+
this.hT = "17";
|
1340
|
+
/**
|
1341
|
+
* set value by a Date object<br/>
|
1342
|
+
* @name setByDate
|
1343
|
+
* @memberOf KJUR.asn1.DERUTCTime#
|
1344
|
+
* @function
|
1345
|
+
* @param {Date} dateObject Date object to set ASN.1 value(V)
|
1346
|
+
* @example
|
1347
|
+
* o = new KJUR.asn1.DERUTCTime();
|
1348
|
+
* o.setByDate(new Date("2016/12/31"));
|
1349
|
+
*/
|
1350
|
+
this.setByDate = function (dateObject) {
|
1351
|
+
this.hTLV = null;
|
1352
|
+
this.isModified = true;
|
1353
|
+
this.date = dateObject;
|
1354
|
+
this.s = this.formatDate(this.date, 'utc');
|
1355
|
+
this.hV = stohex(this.s);
|
1356
|
+
};
|
1357
|
+
this.getFreshValueHex = function () {
|
1358
|
+
if (typeof this.date == "undefined" && typeof this.s == "undefined") {
|
1359
|
+
this.date = new Date();
|
1360
|
+
this.s = this.formatDate(this.date, 'utc');
|
1361
|
+
this.hV = stohex(this.s);
|
1362
|
+
}
|
1363
|
+
return this.hV;
|
1364
|
+
};
|
1365
|
+
if (params !== undefined) {
|
1366
|
+
if (params.str !== undefined) {
|
1367
|
+
this.setString(params.str);
|
1368
|
+
}
|
1369
|
+
else if (typeof params == "string" && params.match(/^[0-9]{12}Z$/)) {
|
1370
|
+
this.setString(params);
|
1371
|
+
}
|
1372
|
+
else if (params.hex !== undefined) {
|
1373
|
+
this.setStringHex(params.hex);
|
1374
|
+
}
|
1375
|
+
else if (params.date !== undefined) {
|
1376
|
+
this.setByDate(params.date);
|
1377
|
+
}
|
1378
|
+
}
|
1379
|
+
};
|
1380
|
+
YAHOO.lang.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);
|
1381
|
+
// ********************************************************************
|
1382
|
+
/**
|
1383
|
+
* class for ASN.1 DER GeneralizedTime
|
1384
|
+
* @name KJUR.asn1.DERGeneralizedTime
|
1385
|
+
* @class class for ASN.1 DER GeneralizedTime
|
1386
|
+
* @param {Array} params associative array of parameters (ex. {'str': '20130430235959Z'})
|
1387
|
+
* @property {Boolean} withMillis flag to show milliseconds or not
|
1388
|
+
* @extends KJUR.asn1.DERAbstractTime
|
1389
|
+
* @description
|
1390
|
+
* <br/>
|
1391
|
+
* As for argument 'params' for constructor, you can specify one of
|
1392
|
+
* following properties:
|
1393
|
+
* <ul>
|
1394
|
+
* <li>str - specify initial ASN.1 value(V) by a string (ex.'20130430235959Z')</li>
|
1395
|
+
* <li>hex - specify initial ASN.1 value(V) by a hexadecimal string</li>
|
1396
|
+
* <li>date - specify Date object.</li>
|
1397
|
+
* <li>millis - specify flag to show milliseconds (from 1.0.6)</li>
|
1398
|
+
* </ul>
|
1399
|
+
* NOTE1: 'params' can be omitted.
|
1400
|
+
* NOTE2: 'withMillis' property is supported from asn1 1.0.6.
|
1401
|
+
*/
|
1402
|
+
KJUR.asn1.DERGeneralizedTime = function (params) {
|
1403
|
+
KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, params);
|
1404
|
+
this.hT = "18";
|
1405
|
+
this.withMillis = false;
|
1406
|
+
/**
|
1407
|
+
* set value by a Date object
|
1408
|
+
* @name setByDate
|
1409
|
+
* @memberOf KJUR.asn1.DERGeneralizedTime#
|
1410
|
+
* @function
|
1411
|
+
* @param {Date} dateObject Date object to set ASN.1 value(V)
|
1412
|
+
* @example
|
1413
|
+
* When you specify UTC time, use 'Date.UTC' method like this:<br/>
|
1414
|
+
* o1 = new DERUTCTime();
|
1415
|
+
* o1.setByDate(date);
|
1416
|
+
*
|
1417
|
+
* date = new Date(Date.UTC(2015, 0, 31, 23, 59, 59, 0)); #2015JAN31 23:59:59
|
1418
|
+
*/
|
1419
|
+
this.setByDate = function (dateObject) {
|
1420
|
+
this.hTLV = null;
|
1421
|
+
this.isModified = true;
|
1422
|
+
this.date = dateObject;
|
1423
|
+
this.s = this.formatDate(this.date, 'gen', this.withMillis);
|
1424
|
+
this.hV = stohex(this.s);
|
1425
|
+
};
|
1426
|
+
this.getFreshValueHex = function () {
|
1427
|
+
if (this.date === undefined && this.s === undefined) {
|
1428
|
+
this.date = new Date();
|
1429
|
+
this.s = this.formatDate(this.date, 'gen', this.withMillis);
|
1430
|
+
this.hV = stohex(this.s);
|
1431
|
+
}
|
1432
|
+
return this.hV;
|
1433
|
+
};
|
1434
|
+
if (params !== undefined) {
|
1435
|
+
if (params.str !== undefined) {
|
1436
|
+
this.setString(params.str);
|
1437
|
+
}
|
1438
|
+
else if (typeof params == "string" && params.match(/^[0-9]{14}Z$/)) {
|
1439
|
+
this.setString(params);
|
1440
|
+
}
|
1441
|
+
else if (params.hex !== undefined) {
|
1442
|
+
this.setStringHex(params.hex);
|
1443
|
+
}
|
1444
|
+
else if (params.date !== undefined) {
|
1445
|
+
this.setByDate(params.date);
|
1446
|
+
}
|
1447
|
+
if (params.millis === true) {
|
1448
|
+
this.withMillis = true;
|
1449
|
+
}
|
1450
|
+
}
|
1451
|
+
};
|
1452
|
+
YAHOO.lang.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);
|
1453
|
+
// ********************************************************************
|
1454
|
+
/**
|
1455
|
+
* class for ASN.1 DER Sequence
|
1456
|
+
* @name KJUR.asn1.DERSequence
|
1457
|
+
* @class class for ASN.1 DER Sequence
|
1458
|
+
* @extends KJUR.asn1.DERAbstractStructured
|
1459
|
+
* @description
|
1460
|
+
* <br/>
|
1461
|
+
* As for argument 'params' for constructor, you can specify one of
|
1462
|
+
* following properties:
|
1463
|
+
* <ul>
|
1464
|
+
* <li>array - specify array of ASN1Object to set elements of content</li>
|
1465
|
+
* </ul>
|
1466
|
+
* NOTE: 'params' can be omitted.
|
1467
|
+
*/
|
1468
|
+
KJUR.asn1.DERSequence = function (params) {
|
1469
|
+
KJUR.asn1.DERSequence.superclass.constructor.call(this, params);
|
1470
|
+
this.hT = "30";
|
1471
|
+
this.getFreshValueHex = function () {
|
1472
|
+
var h = '';
|
1473
|
+
for (var i = 0; i < this.asn1Array.length; i++) {
|
1474
|
+
var asn1Obj = this.asn1Array[i];
|
1475
|
+
h += asn1Obj.getEncodedHex();
|
1476
|
+
}
|
1477
|
+
this.hV = h;
|
1478
|
+
return this.hV;
|
1479
|
+
};
|
1480
|
+
};
|
1481
|
+
YAHOO.lang.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);
|
1482
|
+
// ********************************************************************
|
1483
|
+
/**
|
1484
|
+
* class for ASN.1 DER Set
|
1485
|
+
* @name KJUR.asn1.DERSet
|
1486
|
+
* @class class for ASN.1 DER Set
|
1487
|
+
* @extends KJUR.asn1.DERAbstractStructured
|
1488
|
+
* @description
|
1489
|
+
* <br/>
|
1490
|
+
* As for argument 'params' for constructor, you can specify one of
|
1491
|
+
* following properties:
|
1492
|
+
* <ul>
|
1493
|
+
* <li>array - specify array of ASN1Object to set elements of content</li>
|
1494
|
+
* <li>sortflag - flag for sort (default: true). ASN.1 BER is not sorted in 'SET OF'.</li>
|
1495
|
+
* </ul>
|
1496
|
+
* NOTE1: 'params' can be omitted.<br/>
|
1497
|
+
* NOTE2: sortflag is supported since 1.0.5.
|
1498
|
+
*/
|
1499
|
+
KJUR.asn1.DERSet = function (params) {
|
1500
|
+
KJUR.asn1.DERSet.superclass.constructor.call(this, params);
|
1501
|
+
this.hT = "31";
|
1502
|
+
this.sortFlag = true; // item shall be sorted only in ASN.1 DER
|
1503
|
+
this.getFreshValueHex = function () {
|
1504
|
+
var a = new Array();
|
1505
|
+
for (var i = 0; i < this.asn1Array.length; i++) {
|
1506
|
+
var asn1Obj = this.asn1Array[i];
|
1507
|
+
a.push(asn1Obj.getEncodedHex());
|
1508
|
+
}
|
1509
|
+
if (this.sortFlag == true)
|
1510
|
+
a.sort();
|
1511
|
+
this.hV = a.join('');
|
1512
|
+
return this.hV;
|
1513
|
+
};
|
1514
|
+
if (typeof params != "undefined") {
|
1515
|
+
if (typeof params.sortflag != "undefined" &&
|
1516
|
+
params.sortflag == false)
|
1517
|
+
this.sortFlag = false;
|
1518
|
+
}
|
1519
|
+
};
|
1520
|
+
YAHOO.lang.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);
|
1521
|
+
// ********************************************************************
|
1522
|
+
/**
|
1523
|
+
* class for ASN.1 DER TaggedObject
|
1524
|
+
* @name KJUR.asn1.DERTaggedObject
|
1525
|
+
* @class class for ASN.1 DER TaggedObject
|
1526
|
+
* @extends KJUR.asn1.ASN1Object
|
1527
|
+
* @description
|
1528
|
+
* <br/>
|
1529
|
+
* Parameter 'tagNoNex' is ASN.1 tag(T) value for this object.
|
1530
|
+
* For example, if you find '[1]' tag in a ASN.1 dump,
|
1531
|
+
* 'tagNoHex' will be 'a1'.
|
1532
|
+
* <br/>
|
1533
|
+
* As for optional argument 'params' for constructor, you can specify *ANY* of
|
1534
|
+
* following properties:
|
1535
|
+
* <ul>
|
1536
|
+
* <li>explicit - specify true if this is explicit tag otherwise false
|
1537
|
+
* (default is 'true').</li>
|
1538
|
+
* <li>tag - specify tag (default is 'a0' which means [0])</li>
|
1539
|
+
* <li>obj - specify ASN1Object which is tagged</li>
|
1540
|
+
* </ul>
|
1541
|
+
* @example
|
1542
|
+
* d1 = new KJUR.asn1.DERUTF8String({'str':'a'});
|
1543
|
+
* d2 = new KJUR.asn1.DERTaggedObject({'obj': d1});
|
1544
|
+
* hex = d2.getEncodedHex();
|
1545
|
+
*/
|
1546
|
+
KJUR.asn1.DERTaggedObject = function (params) {
|
1547
|
+
KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);
|
1548
|
+
this.hT = "a0";
|
1549
|
+
this.hV = '';
|
1550
|
+
this.isExplicit = true;
|
1551
|
+
this.asn1Object = null;
|
1552
|
+
/**
|
1553
|
+
* set value by an ASN1Object
|
1554
|
+
* @name setString
|
1555
|
+
* @memberOf KJUR.asn1.DERTaggedObject#
|
1556
|
+
* @function
|
1557
|
+
* @param {Boolean} isExplicitFlag flag for explicit/implicit tag
|
1558
|
+
* @param {Integer} tagNoHex hexadecimal string of ASN.1 tag
|
1559
|
+
* @param {ASN1Object} asn1Object ASN.1 to encapsulate
|
1560
|
+
*/
|
1561
|
+
this.setASN1Object = function (isExplicitFlag, tagNoHex, asn1Object) {
|
1562
|
+
this.hT = tagNoHex;
|
1563
|
+
this.isExplicit = isExplicitFlag;
|
1564
|
+
this.asn1Object = asn1Object;
|
1565
|
+
if (this.isExplicit) {
|
1566
|
+
this.hV = this.asn1Object.getEncodedHex();
|
1567
|
+
this.hTLV = null;
|
1568
|
+
this.isModified = true;
|
1569
|
+
}
|
1570
|
+
else {
|
1571
|
+
this.hV = null;
|
1572
|
+
this.hTLV = asn1Object.getEncodedHex();
|
1573
|
+
this.hTLV = this.hTLV.replace(/^../, tagNoHex);
|
1574
|
+
this.isModified = false;
|
1575
|
+
}
|
1576
|
+
};
|
1577
|
+
this.getFreshValueHex = function () {
|
1578
|
+
return this.hV;
|
1579
|
+
};
|
1580
|
+
if (typeof params != "undefined") {
|
1581
|
+
if (typeof params['tag'] != "undefined") {
|
1582
|
+
this.hT = params['tag'];
|
1583
|
+
}
|
1584
|
+
if (typeof params['explicit'] != "undefined") {
|
1585
|
+
this.isExplicit = params['explicit'];
|
1586
|
+
}
|
1587
|
+
if (typeof params['obj'] != "undefined") {
|
1588
|
+
this.asn1Object = params['obj'];
|
1589
|
+
this.setASN1Object(this.isExplicit, this.hT, this.asn1Object);
|
1590
|
+
}
|
1591
|
+
}
|
1592
|
+
};
|
1593
|
+
YAHOO.lang.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);
|