fasc

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2020 License: MIT Imports: 2 Imported by: 3

README

go-fasc

FASC, or the Federal Agency Smartcard Number is a legacy specification that stores physical security information that's encoded into smartcards. Internally, this is stored as a 5-bit-byte packed into 8 bit bytes. This library unpacks the bytestream unto an idiomatic struct, to be further handled by the user.

This spec is nearly completely undocumented, and woefully hard to understand. In so far as it's used within the federal government, some serious work needs to be done in order to properly store and process data. This library requires an in-depth understanding of FASC's quirks and internal representation.

Documentation

Index

Constants

View Source
const (
	// OrganizationalCategoryFederalGoverment indicates the organization
	// is a part of the federal government.
	OrganizationalCategoryFederalGoverment OrganizationalCategory = 1

	// OrganizationalCategoryStateGovernment indicates the organization
	// is a part of a state government.
	OrganizationalCategoryStateGovernment OrganizationalCategory = 2

	// OrganizationalCategoryCommercialEnterprise indicates the organization
	// is a company, or other commercial enterprise.
	OrganizationalCategoryCommercialEnterprise OrganizationalCategory = 3

	// OrganizationalCategoryForeignGovernment indicates the organization
	// is a foreign government.
	OrganizationalCategoryForeignGovernment OrganizationalCategory = 4

	// AssociationCategoryEmployee indicates the individual is an employee
	// of the organization in question.
	AssociationCategoryEmployee AssociationCategory = 1

	// AssociationCategoryCivil indidicates the individual is a civilian
	// employee of a branch of the military.
	AssociationCategoryCivil AssociationCategory = 2

	// AssociationCategoryExecutiveStaff indidicates the individual is a
	// member of the executive staff.
	AssociationCategoryExecutiveStaff AssociationCategory = 3

	// AssociationCategoryUniformedServivce indidicates the individual is a
	// member of the uniformed service of a branch of the military.
	AssociationCategoryUniformedServivce AssociationCategory = 4

	// AssociationCategoryContractor indidicates the individual is acting
	// as a contractor for the organization.
	AssociationCategoryContractor AssociationCategory = 5

	// AssociationCategoryAffiliate indidicates the individual was issued
	// a credential on the basis of being affiliated with the organization.
	AssociationCategoryAffiliate AssociationCategory = 6

	// AssociationCategoryBeneficiary indidicates the individual is a
	// beneficiary of the organization.
	AssociationCategoryBeneficiary AssociationCategory = 7
)

Variables

View Source
var (
	// FIPS95_2AgencyCodes contains an enumeration of all understood
	// FIPS95 agency codes.
	FIPS95_2AgencyCodes = map[int]string{
		0300: "LIBRARY OF CONGRESS",
		0500: "GOVERNMENT ACCOUNTABILITY OFFICE",
		1027: "ADMINISTRATIVE OFFICE OF THE U.S. COURTS",
		1100: "EXECUTIVE OFFICE OF THE PRESIDENT",
		1145: "PEACE CORPS",
		1153: "UNITED STATES TRADE AND DEVELOPMENT AGENCY",
		1200: "AGRICULTURE, DEPARTMENT OF",
		1300: "COMMERCE, DEPARTMENT OF",
		1400: "INTERIOR, DEPARTMENT OF THE",
		1500: "JUSTICE, DEPARTMENT OF",
		1600: "LABOR, DEPARTMENT OF",
		1665: "PENSION BENEFIT GUARANTY CORPORATION",
		1800: "POSTAL SERVICE",
		1900: "STATE, DEPARTMENT OF",
		2000: "TREASURY, DEPARTMENT OF THE",
		2300: "U.S. TAX COURT",
		2400: "OFFICE OF PERSONNEL MANAGEMENT",
		2700: "FEDERAL COMMUNICATIONS COMMISSION",
		2800: "SOCIAL SECURITY ADMINISTRATION",
		2900: "FEDERAL TRADE COMMISSION",
		3100: "NUCLEAR REGULATORY COMMISSION",
		3300: "SMITHSONIAN INSTITUTION",
		3352: "J. F. KENNEDY CENTER FOR THE PERFORMING ARTS",
		3355: "NATIONAL GALLERY OF ART",
		3400: "INTERNATIONAL TRADE COMMISSION",
		3600: "VETERANS AFFAIRS, DEPARTMENT OF",
		4100: "MERIT SYSTEMS PROTECTION BOARD",
		4500: "EQUAL EMPLOYMENT OPPORTUNITY COMMISSION",
		4602: "APPALACHIAN REGIONAL COMMISSION",
		4700: "GENERAL SERVICES ADMINISTRATION",
		4900: "NATIONAL SCIENCE FOUNDATION",
		5000: "SECURITIES AND EXCHANGE COMMISSION",
		5300: "THE INSTITUE OF MUSEUM AND LIBRARY SERVICES",
		5400: "FEDERAL LABOR RELATIONS AUTHORITY",
		5920: "NATIONAL ENDOWMENT FOR THE ARTS",
		5940: "NATIONAL ENDOWMENT FOR THE HUMANITIES",
		6000: "RAILROAD RETIREMENT BOARD",
		6100: "CONSUMER PRODUCT SAFETY COMMISSION",
		6201: "OFFICE OF SPECIAL COUNSEL",
		6300: "NATIONAL LABOR RELATIONS BOARD",
		6500: "FEDERAL MARITIME COMMISSION",
		6800: "ENVIRONMENTAL PROTECTION AGENCY",
		6900: "TRANSPORTATION, DEPARTMENT OF",
		7000: "HOMELAND SECURITY, DEPARTMENT OF",
		7100: "OVERSEAS PRIVATE INVESTMENT CORPORATION",
		7200: "AGENCY FOR INTERNATIONAL DEVELOPMENT",
		7300: "SMALL BUSINESS ADMINISTRATION",
		7400: "AMERICAN BATTLE MONUMENTS COMMISSION",
		7500: "HEALTH AND HUMAN SERVICES, DEPARTMENT OF",
		8000: "NATIONAL AERONAUTICS AND SPACE ADMINISTRATION",
		8300: "EXPORT-IMPORT BANK OF THE U.S.",
		8600: "HOUSING AND URBAN DEVELOPMENT, DEPARTMENT OF",
		8800: "NATIONAL ARCHIVES AND RECORDS ADMINISTRATION",
		8900: "ENERGY, DEPARTMENT OF",
		9000: "SELECTIVE SERVICE SYSTEM",
		9100: "EDUCATION, DEPARTMENT OF",
		9300: "FEDERAL MEDIATION AND CONCILIATION SERVICE",
		9502: "NATIONAL CAPITAL PLANNING COMMISSION",
		9504: "FEDERAL MINE SAFETY AND HEALTH REVIEW COMMISSION",
		9505: "SURFACE TRANSPORTATION BOARD",
		9506: "FEDERAL ELECTION COMMISSION",
		9507: "COMMODITY FUTURES TRADING COMMISSION",
		9508: "NATIONAL TRANSPORTATION SAFETY BOARD",
		9511: "THE COUNCIL OF THE INSPECTORS GENERAL ON INTEGRITY AND EFFICIENCY ",
		9513: "MARINE MAMMAL COMMISSION",
		9514: "OCCUPATIONAL SAFETY AND HEALTH REVIEW COMMISSION",
		9515: "ADMINISTRATIVE CONFERENCE OF THE U. S.",
		9516: "DEFENSE NUCLEAR FACILITIES SAFETY BOARD",
		9518: "COMMITTEE FOR PURCHASE FROM PEOPLE WHO ARE BLIND OR SEVERELY DISABLED",
		9523: "ELECTION ASSISTANCE COMMISSION",
		9524: "NATIONAL MEDIATION BOARD",
		9526: "PRIVACY AND CIVIL LIBERTIES OVERSIGHT BOARD",
		9532: "ARCHITECTURAL AND TRANSPORTATION BARRIERS COMPLIANCE BOARD",
		9533: "GULF COAST ECOSYSTEM RESTORATION COUNCIL",
		9536: "VIETNAM EDUCATION FOUNDATION",
		9537: "COMMISSION OF FINE ARTS",
		9542: "FEDERAL HOUSING FINANCE AGENCY",
		9543: "MILLENIUM CHALLENGE CORPORATION",
		9545: "MORRIS K. UDALL SCHOLARSHIP AND EXCELLENCE IN NATIONAL ENVIRONMENTAL POLICY FOUNDATION",
		9549: "OFFICE OF GOVERNMENT ETHICS",
		9557: "NORTHERN BORDER REGIONAL COMMISSION",
		9565: "CHEMICAL SAFETY AND HAZARD INVESTIGATION BOARD",
		9568: "UNITED STATES AGENCY FOR GLOBAL MEDIA, BBG",
		9572: "DENALI COMMISSION",
		9577: "CORPORATION FOR NATIONAL AND COMMUNITY SERVICE",
		9594: "COURT SERVICES AND OFFENDER SUPERVISION AGENCY",
		9700: "DEPT OF DEFENSE",
		5700: "DEPT OF AIR FORCE",
		1700: "DEPT OF NAVY",
	}
)

Functions

This section is empty.

Types

type AgencyCode

type AgencyCode int

AgencyCode is an enumeration of US Government Agencies, contained within FIPS 95.

func (AgencyCode) String

func (o AgencyCode) String() string

String will return the human readable name for the agency of the government.

type AssociationCategory

type AssociationCategory int

AssociationCategory is the type of relationship between the individual and the Organization. This is something like "employee", or "contractor".

func (AssociationCategory) String

func (ac AssociationCategory) String() string

String will return a human readable string version of the AssociationCategory.

type FASC

type FASC struct {
	// Agency Code identifies what Government agnecy issued the credential.
	// This is usually a FIPS 95-2 federal agency code. An incomplete table
	// of these values is provided in this library, but this type is just a
	// retyped Int, direct access of the underlying value is encouraged.
	AgencyCode AgencyCode

	// Identifies the system the card is enrolled in.
	SystemCode int

	// Unique for the given system. This plus the system and agency code should
	// be a unique identifier for this token.
	Credential int

	// Major version changes in the data above.
	CredentialSeries int

	// Individual incrementing counter for the number of times a card has been
	// replaced due to loss or damage.
	IndidvidualCredentialSeries int

	// Unique identifier for an individual. This is sometimes a fairly low
	// incrementing identifier for the ACL system, and other times it's an
	// agency-wide globally unique identifier such as an EDIPI.
	PersonIdentifier int

	// Type of orgnaization that the cardholder belongs to.
	//
	// A table of values is provided in this library, but this is a masked
	// integer in the event you need direct access. It's likely easier to
	// set up a switch statement using the defined constants on this, though.
	//
	// Valid values here are:
	//
	//  - Federal Government Agency
	//  - State Government Agency
	//  - Commercial Enterprise
	//  - Foreign Government
	//
	OrganizationCategory OrganizationalCategory

	// For the particular category above, this is an iditifier to determine
	// which agency, state, company or government this cardholder is a part
	// of.
	//
	// Given a Federal Government Agency, this will be a FIPS 95-2 agency code.
	// Given a State Government Agency, this will be a State Code.
	// Given a Commercial Enterprise, this will be a Company Code
	// Given a Foreign Government, this will be a Country Code.
	OrganizationIdentifier AgencyCode

	// What the relation of this person to the above organization is.
	//
	// This is a masked int, and direct access to the underlying value may
	// be helpful, but it may be more helpful to use the defined constants.
	//
	// Valid values here are:
	//
	//  - Employee
	//  - Civil
	//  - Executive Staff
	//  - Uniformed Service
	//  - Contractor
	//  - Organizational Affiliate
	//  - Organizational Beneficiary
	//
	PersonAssociation AssociationCategory
}

FASC -- or Federal Agency Smart Credential, contains information regarding the organization that has issued the credential, the individual who holds the credential, and relationship betwen them.

func Parse

func Parse(data []byte) (*FASC, error)

Parse packed 8-bit-byte FASC blobs into a FASC struct containing the parsed information.

func (FASC) String

func (f FASC) String() string

String will return a human readable debug string containing the core information contained in the FASC data structure.

type OrganizationalCategory

type OrganizationalCategory int

OrganizationalCategory is the cateogry of organization referenced, such as the Federal Government, State Government, or a Company.

func (OrganizationalCategory) String

func (oc OrganizationalCategory) String() string

String will return a human readable string version of the OrganizationalCategory.

Directories

Path Synopsis
internal
bdc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL