PublicKeyInfopublic class PublicKeyInfo extends Object The information that needs to be stored for a public key. |
Fields Summary |
---|
public static final byte | OWNER_TAGUsed to tag the owner field in a serialized key. | public static final byte | NOT_BEFORE_TAGUsed to tag the notBefore field in a serialized key. | public static final byte | NOT_AFTER_TAGUsed to tag the notAfter field in a serialized key. | public static final byte | MODULUS_TAGUsed to tag the modulus field in a serialized key. | public static final byte | EXPONENT_TAGUsed to tag the exponent field in a serialized key. | public static final byte | DOMAIN_TAGUsed to gat the domain field in a serialized key. | private String | ownerDistinguished Name of the owner. | private long | notBeforeStart of the key's validity period in milliseconds since Jan 1, 1970. | private long | notAfterEnd of the key's validity period in milliseconds since Jan 1, 1970. | private byte[] | modulusRSA modulus for the public key. | private byte[] | exponentRSA exponent for the public key. | private String | domainName of the security domain. |
Constructors Summary |
---|
public PublicKeyInfo(String owner, long notBefore, long notAfter, byte[] modulus, byte[] exponent, String domain)Constructs a PublicKeyInfo object with the specified attributes.
This constructor is only used by PublicKeyInfo and its subclasses.
this.owner = owner;
this.notBefore = notBefore;
this.notAfter = notAfter;
this.modulus = modulus;
this.exponent = exponent;
this.domain = domain;
|
Methods Summary |
---|
public java.lang.String | getDomain()Gets name of the security domain for this key.
if (domain == null) {
return "untrusted";
}
return domain;
| public byte[] | getExponent()Gets RSA exponent of the public key.
byte[] retVal = new byte[exponent.length];
System.arraycopy(exponent, 0, retVal, 0, exponent.length);
return retVal;
| static com.sun.midp.publickeystore.PublicKeyInfo | getKeyFromStorage(InputStorage storage)Deserializes a public key from storage.
byte[] tag;
Object value;
String owner;
long notBefore;
long notAfter;
byte[] modulus;
byte[] exponent;
String domain;
tag = new byte[1];
value = storage.readValue(tag);
if (value == null) {
// no more keys
return null;
}
if (tag[0] != OWNER_TAG) {
throw new IOException("public key storage corrupted");
}
owner = (String)value;
value = storage.readValue(tag);
if (tag[0] != NOT_BEFORE_TAG) {
throw new IOException("public key storage corrupted");
}
notBefore = ((Long)value).longValue();
value = storage.readValue(tag);
if (tag[0] != NOT_AFTER_TAG) {
throw new IOException("public key storage corrupted");
}
notAfter = ((Long)value).longValue();
value = storage.readValue(tag);
if (tag[0] != MODULUS_TAG) {
throw new IOException("public key storage corrupted");
}
modulus = (byte[])value;
value = storage.readValue(tag);
if (tag[0] != EXPONENT_TAG) {
throw new IOException("public key storage corrupted");
}
exponent = (byte[])value;
value = storage.readValue(tag);
if (tag[0] != DOMAIN_TAG) {
throw new IOException("public key storage corrupted");
}
domain = (String)value;
return new PublicKeyInfo(owner, notBefore, notAfter,
modulus, exponent, domain);
| public byte[] | getModulus()Gets RSA modulus of the public key.
byte[] retVal = new byte[modulus.length];
System.arraycopy(modulus, 0, retVal, 0, modulus.length);
return retVal;
| public long | getNotAfter()Gets the end of the key's validity period in
milliseconds since Jan 1, 1970.
return notAfter;
| public long | getNotBefore()Gets the start of the key's validity period in
milliseconds since Jan 1, 1970.
return notBefore;
| public java.lang.String | getOwner()Gets the distinguished name of the key's owner.
return owner;
| public void | setDomain(java.lang.String domain)Sets the name of the security domain for this key if it does not have
a domain.
if (domain != null) {
return;
}
this.domain = domain;
|
|