001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)MsgSignerPrincipal.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: /**
030: * MsgSignerPrincipal.java
031: *
032: * SUN PROPRIETARY/CONFIDENTIAL.
033: * This software is the proprietary information of Sun Microsystems, Inc.
034: * Use is subject to license terms.
035: *
036: * Created on February 11, 2005, 3:12 PM
037: */package com.sun.jbi.security;
038:
039: import javax.security.auth.x500.X500Principal;
040:
041: /**
042: * This is a Principal class created soley to add a MsgSignerPrincipal Type.
043: * The name of this Principal is the Subject DN from the ( Message ) Signers Public Key
044: * Certificate.
045: *
046: * This is a wrapper around X500 Principal.
047: *
048: * @author Sun Microsystems, Inc.
049: */
050: public class MsgSignerPrincipal extends X500PrincipalWrapper implements
051: java.security.Principal, java.io.Serializable {
052: /**
053: * Creates a new instance of MsgSignerPrincipal.
054: *
055: * @param name an X.500 distinguished name in RFC 1779 or RFC 2253 format.
056: * @see javax.security.auth.x500.X500Principal
057: */
058: public MsgSignerPrincipal(String name) {
059: super (name);
060: }
061:
062: /**
063: * Creates a new instance of MsgSignerPrincipal.
064: *
065: * @param name a byte array containing the distinguished name in ASN.1 DER
066: * encoded form.
067: * @see javax.security.auth.x500.X500Principal
068: */
069: public MsgSignerPrincipal(byte[] name) {
070: super (name);
071: }
072:
073: /**
074: * Creates a new instance of MsgSignerPrincipal.
075: *
076: * @param fis an InputStream containing the distinguished name in ASN.1 DER
077: * encoded form.
078: *
079: * @see javax.security.auth.x500.X500Principal
080: */
081: public MsgSignerPrincipal(java.io.FileInputStream fis) {
082: super (fis);
083: }
084:
085: /**
086: * Creates a new instance of SSLClientPrincipal.
087: *
088: * @param x500Principal is the X500Principal this class
089: * encapsulates.
090: *
091: * @see javax.security.auth.x500.X500Principal
092: */
093: public MsgSignerPrincipal(X500Principal x500Principal) {
094: super (x500Principal);
095: }
096:
097: /**
098: * Compares the specified Object with this X500Principal for equality.
099: * Specifically, this method returns true if the Object o is an X500Principal
100: * and if the respective canonical string representations (obtained via the
101: * getName(X500Principal.CANONICAL) method) of this object and o are equal.
102: *
103: * @param o object to compare
104: * @return true if the specified Object is equal to this X500Principal,
105: * false otherwise
106: */
107: public boolean equals(Object o) {
108: if (o == null) {
109: return false;
110: }
111:
112: if (o instanceof MsgSignerPrincipal) {
113: return getName(X500Principal.CANONICAL).equals(
114: ((MsgSignerPrincipal) o)
115: .getName(X500Principal.CANONICAL));
116: }
117:
118: return false;
119: }
120:
121: /**
122: * Return a hash code for this X500Principal.
123: *
124: * The hash code is calculated via: getName(X500Principal.CANONICAL).hashCode()
125: *
126: * @return a hash code for this X500Principal.
127: */
128: public int hashCode() {
129: return super.hashCode();
130: }
131: }
|