001// SPDX-FileCopyrightText: 2018 Paul Schaub <vanitasvitae@fsfe.org> 002// 003// SPDX-License-Identifier: Apache-2.0 004 005package org.pgpainless.util.selection.keyring.impl; 006 007import org.bouncycastle.openpgp.PGPPublicKeyRing; 008import org.bouncycastle.openpgp.PGPSecretKeyRing; 009 010public final class XMPP { 011 012 private XMPP() { 013 014 } 015 016 public static class PubRingSelectionStrategy extends ExactUserId.PubRingSelectionStrategy { 017 018 @Override 019 public boolean accept(String jid, PGPPublicKeyRing keyRing) { 020 if (!jid.matches("^xmpp:.+$")) { 021 jid = "xmpp:" + jid; 022 } 023 return super.accept(jid, keyRing); 024 } 025 } 026 027 public static class SecRingSelectionStrategy extends ExactUserId.SecRingSelectionStrategy { 028 029 @Override 030 public boolean accept(String jid, PGPSecretKeyRing keyRing) { 031 if (!jid.matches("^xmpp:.+$")) { 032 jid = "xmpp:" + jid; 033 } 034 return super.accept(jid, keyRing); 035 } 036 } 037}