001/** 002 * 003 * Copyright 2018 Paul Schaub. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.ox.store.definition; 018 019import org.jivesoftware.smackx.ox.OpenPgpContact; 020import org.jivesoftware.smackx.ox.callback.SecretKeyPassphraseCallback; 021 022import org.jxmpp.jid.BareJid; 023import org.pgpainless.key.protection.SecretKeyRingProtector; 024import org.pgpainless.key.protection.UnprotectedKeysProtector; 025 026public interface OpenPgpStore extends OpenPgpKeyStore, OpenPgpMetadataStore, OpenPgpTrustStore { 027 028 /** 029 * Return an {@link OpenPgpContact} for a contacts jid. 030 * 031 * @param contactsJid {@link BareJid} of the contact. 032 * @return {@link OpenPgpContact} object of the contact. 033 */ 034 OpenPgpContact getOpenPgpContact(BareJid contactsJid); 035 036 /** 037 * Set a {@link SecretKeyRingProtector} which is used to decrypt password protected secret keys. 038 * 039 * @param unlocker unlocker which unlocks encrypted secret keys. 040 */ 041 void setKeyRingProtector(SecretKeyRingProtector unlocker); 042 043 /** 044 * Return the {@link SecretKeyRingProtector} which is used to decrypt password protected secret keys. 045 * In case no {@link SecretKeyRingProtector} has been set, this method MUST return an {@link UnprotectedKeysProtector}. 046 * 047 * @return secret key unlocker. 048 */ 049 SecretKeyRingProtector getKeyRingProtector(); 050 051 /** 052 * Set a {@link SecretKeyPassphraseCallback} which is called in case we stumble over a secret key for which we have 053 * no passphrase. 054 * 055 * @param callback callback. MUST NOT be null. 056 */ 057 void setSecretKeyPassphraseCallback(SecretKeyPassphraseCallback callback); 058 059}