public class PushCertificateIdent
extends java.lang.Object
This is similar to a PersonIdent
in that it
contains a name, timestamp, and timezone offset, but differs in the following
ways:
getUserId()
, but getEmailAddress()
may return
null.getRaw()
. This is necessary for losslessly reconstructing the signed
push certificate payload.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
raw |
private int |
tzOffset |
private java.lang.String |
userId |
private long |
when |
Modifier | Constructor and Description |
---|---|
|
PushCertificateIdent(java.lang.String userId,
long when,
int tzOffset)
Construct a new identity from an OpenPGP User ID.
|
private |
PushCertificateIdent(java.lang.String raw,
java.lang.String userId,
long when,
int tzOffset) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getEmailAddress()
Get the email portion of the User ID
|
java.lang.String |
getName()
Get the name portion of the User ID.
|
java.lang.String |
getRaw()
Get the raw string from which this identity was parsed.
|
java.util.TimeZone |
getTimeZone()
Get this person's declared time zone
|
int |
getTimeZoneOffset()
Get this person's declared time zone as minutes east of UTC.
|
java.lang.String |
getUserId()
Get the OpenPGP User ID, which may be any string.
|
java.util.Date |
getWhen()
Get the timestamp of the identity.
|
int |
hashCode() |
static PushCertificateIdent |
parse(java.lang.String str)
Parse an identity from a string.
|
java.lang.String |
toString() |
private final java.lang.String raw
private final java.lang.String userId
private final long when
private final int tzOffset
public PushCertificateIdent(java.lang.String userId, long when, int tzOffset)
userId
- OpenPGP User ID; any UTF-8 string.when
- local time.tzOffset
- timezone offset; see getTimeZoneOffset()
.private PushCertificateIdent(java.lang.String raw, java.lang.String userId, long when, int tzOffset)
public static PushCertificateIdent parse(java.lang.String str)
Spaces are trimmed when parsing the timestamp and timezone offset, with one exception. The timestamp must be preceded by a single space, and the rest of the string prior to that space (including any additional whitespace) is treated as the OpenPGP User ID.
If either the timestamp or timezone offsets are missing, mimics
RawParseUtils.parsePersonIdent(String)
behavior and sets them
both to zero.
str
- string to parse.PushCertificateIdent
object.public java.lang.String getRaw()
If the string was constructed manually, a suitable canonical string is returned.
For the purposes of bytewise comparisons with other OpenPGP IDs, the string must be encoded as UTF-8.
public java.lang.String getUserId()
public java.lang.String getName()
getEmailAddress()
, returns the full User ID
with spaces trimmed.public java.lang.String getEmailAddress()
getUserId()
, or null.public java.util.Date getWhen()
public java.util.TimeZone getTimeZone()
public int getTimeZoneOffset()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object