Class EncryptionKey
- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<Integer,V>
-
- com.aoindustries.aoserv.client.CachedObjectIntegerKey<EncryptionKey>
-
- com.aoindustries.aoserv.client.pki.EncryptionKey
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,AOServReadable,AOServStreamable,AOServWritable,SingleTableObject<Integer,EncryptionKey>
public final class EncryptionKey extends CachedObjectIntegerKey<EncryptionKey>
Stores the list of encryption keys for a business. The keys themselves are GPG keys and are stored by GPG.- Author:
- AO Industries, Inc.
- See Also:
Account
-
-
Field Summary
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
-
Constructor Summary
Constructors Constructor Description EncryptionKey()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdecrypt(String ciphertext, String passphrase)Uses the private key to decrypt the data and verifies the signature.static Stringdecrypt(String recipient, String ciphertext, String passphrase)Uses the provided private key to decrypt the data.Stringencrypt(EncryptionKey recipient, String plaintext)Encrypts a message for the provided recipient and signs with the private key.static Stringencrypt(String signer, String recipient, String plaintext)Uses the provided public key to encrypt the data.AccountgetAccount()Account.NamegetAccount_name()protected ObjectgetColumnImpl(int i)StringgetId()Gets the id of the key use for GPG.Table.TableIDgetTableID()voidinit(ResultSet result)Initializes this object from the raw database contents.voidread(StreamableInput in, AoservProtocol.Version protocolVersion)voidwrite(StreamableOutput out, AoservProtocol.Version protocolVersion)-
Methods inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
equals, getKey, getPkey, hashCode, toStringImpl
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Method Detail
-
encrypt
public static String encrypt(String signer, String recipient, String plaintext) throws IOException
Uses the provided public key to encrypt the data.- Throws:
IOException
-
decrypt
public static String decrypt(String recipient, String ciphertext, String passphrase) throws IOException
Uses the provided private key to decrypt the data.- Throws:
IOException
-
getAccount_name
public Account.Name getAccount_name()
-
getAccount
public Account getAccount() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<Integer,EncryptionKey>
-
getId
public String getId()
Gets the id of the key use for GPG. The id must be unique per business.
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<Integer,EncryptionKey>
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<Integer,EncryptionKey>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<Integer,EncryptionKey>- Throws:
IOException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<Integer,EncryptionKey>- Throws:
IOException
-
encrypt
public String encrypt(EncryptionKey recipient, String plaintext) throws IOException
Encrypts a message for the provided recipient and signs with the private key.- Throws:
IOException
-
decrypt
public String decrypt(String ciphertext, String passphrase) throws IOException
Uses the private key to decrypt the data and verifies the signature.- Throws:
IOException
-
-