Added in API level 1
Deprecated in API level 3

Signer

abstract class Signer : Identity

This class is used to represent an Identity that can also digitally sign data.

The management of a signer's private keys is an important and sensitive issue that should be handled by subclasses as appropriate to their intended use.

Summary

Public constructors
Signer(name: String!)

Creates a signer with the specified identity name.

Signer(name: String!, scope: IdentityScope!)

Creates a signer with the specified identity name and scope.

Protected constructors

Creates a signer.

Public methods
open PrivateKey!

Returns this signer's private key.

Unit

Sets the key pair (public key and private key) for this signer.

open String

Returns a string of information about the signer.

Inherited functions
Unit addCertificate(certificate: Certificate!)

Adds a certificate for this identity. If the identity has a public key, the public key in the certificate must be the same, and if the identity does not have a public key, the identity's public key is set to be that specified in the certificate.

First, if there is a security manager, its checkSecurityAccess method is called with "addIdentityCertificate" as its argument to see if it's ok to add a certificate.

Array<Certificate!>! certificates()

Returns a copy of all the certificates for this identity.

Boolean equals(other: Any?)

Tests for equality between the specified object and this identity. This first tests to see if the entities actually refer to the same object, in which case it returns true. Next, it checks to see if the entities have the same name and the same scope. If they do, the method returns true. Otherwise, it calls identityEquals, which subclasses should override.

String! getInfo()

Returns general information previously specified for this identity.

String! getName()

Returns this identity's name.

PublicKey! getPublicKey()

Returns this identity's public key.

IdentityScope! getScope()

Returns this identity's scope.

Int hashCode()

Returns a hashcode for this identity.

Boolean identityEquals(identity: Identity!)

Tests for equality between the specified identity and this identity. This method should be overriden by subclasses to test for equality. The default behavior is to return true if the names and public keys are equal.

Unit removeCertificate(certificate: Certificate!)

Removes a certificate from this identity.

First, if there is a security manager, its checkSecurityAccess method is called with "removeIdentityCertificate" as its argument to see if it's ok to remove a certificate.

Unit setInfo(info: String!)

Specifies a general information string for this identity.

First, if there is a security manager, its checkSecurityAccess method is called with "setIdentityInfo" as its argument to see if it's ok to specify the information string.

Unit setPublicKey(key: PublicKey!)

Sets this identity's public key. The old key and all of this identity's certificates are removed by this operation.

First, if there is a security manager, its checkSecurityAccess method is called with "setIdentityPublicKey" as its argument to see if it's ok to set the public key.

String! toString(detailed: Boolean)

Returns a string representation of this identity, with optionally more details than that provided by the toString method without any arguments.

First, if there is a security manager, its checkSecurityAccess method is called with "printIdentity" as its argument to see if it's ok to return the string.

Boolean implies(subject: Subject!)

Returns true if the specified subject is implied by this principal.

Public constructors

Signer

Added in API level 1
Signer(name: String!)

Creates a signer with the specified identity name.

Parameters
name String!: the identity name.

Signer

Added in API level 1
Signer(
    name: String!,
    scope: IdentityScope!)

Creates a signer with the specified identity name and scope.

Parameters
name String!: the identity name.
scope IdentityScope!: the scope of the identity.
Exceptions
java.security.KeyManagementException if there is already an identity with the same name in the scope.

Protected constructors

Signer

Added in API level 1
protected Signer()

Creates a signer. This constructor should only be used for serialization.

Public methods

getPrivateKey

Added in API level 1
open fun getPrivateKey(): PrivateKey!

Deprecated: Deprecated in Java.

Returns this signer's private key.

First, if there is a security manager, its checkSecurityAccess method is called with "getSignerPrivateKey" as its argument to see if it's ok to return the private key.

Return
PrivateKey! this signer's private key, or null if the private key has not yet been set.
Exceptions
java.lang.SecurityException if a security manager exists and its checkSecurityAccess method doesn't allow returning the private key.

setKeyPair

Added in API level 1
fun setKeyPair(pair: KeyPair!): Unit

Deprecated: Deprecated in Java.

Sets the key pair (public key and private key) for this signer.

First, if there is a security manager, its checkSecurityAccess method is called with "setSignerKeyPair" as its argument to see if it's ok to set the key pair.

Parameters
pair KeyPair!: an initialized key pair.
Exceptions
java.security.InvalidParameterException if the key pair is not properly initialized.
java.security.KeyException if the key pair cannot be set for any other reason.
java.lang.SecurityException if a security manager exists and its checkSecurityAccess method doesn't allow setting the key pair.

toString

Added in API level 1
open fun toString(): String

Deprecated: Deprecated in Java.

Returns a string of information about the signer.

Return
String a string of information about the signer.