001package com.hfg.cert; 002 003import com.hfg.util.collection.OrderedMap; 004 005import java.util.Collection; 006import java.util.HashMap; 007import java.util.Map; 008 009//------------------------------------------------------------------------------ 010/** 011 * Types for a certificate Subject Alternative Name (SAN) entry. 012 * 013 * @author J. Alex Taylor, hairyfatguy.com 014 */ 015//------------------------------------------------------------------------------ 016// com.hfg XML/HTML Coding Library 017// 018// This library is free software; you can redistribute it and/or 019// modify it under the terms of the GNU Lesser General Public 020// License as published by the Free Software Foundation; either 021// version 2.1 of the License, or (at your option) any later version. 022// 023// This library is distributed in the hope that it will be useful, 024// but WITHOUT ANY WARRANTY; without even the implied warranty of 025// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 026// Lesser General Public License for more details. 027// 028// You should have received a copy of the GNU Lesser General Public 029// License along with this library; if not, write to the Free Software 030// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 031// 032// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 033// jataylor@hairyfatguy.com 034//------------------------------------------------------------------------------ 035 036public class SAN_Type 037{ 038 // Needs to be declared before the instances 039 private static OrderedMap<Integer, SAN_Type> sLookup = new OrderedMap<>(9); 040 041 public static final SAN_Type OTHER_NAME = new SAN_Type(0, "Other Name"); 042 public static final SAN_Type RFC822_NAME = new SAN_Type(1, "RFC822 Name"); 043 public static final SAN_Type DNS_NAME = new SAN_Type(2, "DNS Name"); 044 public static final SAN_Type X400_ADDRESS = new SAN_Type(3, "X400 Address"); 045 public static final SAN_Type DIRECTORY_NAME = new SAN_Type(4, "Directory Name"); 046 public static final SAN_Type EDI_PARTY_NAME = new SAN_Type(5, "EDI Party Name"); 047 public static final SAN_Type URI = new SAN_Type(6, "URI"); 048 public static final SAN_Type IP_ADDRESS = new SAN_Type(7, "IP Address"); 049 public static final SAN_Type REGISTERED_ID = new SAN_Type(8, "Registered ID"); 050 051 private int mIntValue; 052 private String mName; 053 054 //-------------------------------------------------------------------------- 055 private SAN_Type(int inIntValue, String inName) 056 { 057 mIntValue = inIntValue; 058 mName = inName; 059 060 sLookup.put(mIntValue, this); 061 } 062 063 //-------------------------------------------------------------------------- 064 @Override 065 public String toString() 066 { 067 return mName; 068 } 069 070 //-------------------------------------------------------------------------- 071 public static Collection<SAN_Type> values() 072 { 073 return sLookup.values(); 074 } 075 076 //-------------------------------------------------------------------------- 077 public static SAN_Type valueOf(int inIntValue) 078 { 079 return sLookup.get(inIntValue); 080 } 081}