| 3 | import org.bouncycastle.util.Arrays; |
| 4 | |
| 5 | public class KEKRecipientId |
| 6 | extends RecipientId |
| 7 | { |
| 8 | private byte[] keyIdentifier; |
| 9 | |
| 10 | /** |
| 11 | * Construct a recipient ID with the key identifier of a KEK recipient. |
| 12 | * |
| 13 | * @param keyIdentifier a subjectKeyId |
| 14 | */ |
| 15 | public KEKRecipientId(byte[] keyIdentifier) |
| 16 | { |
| 17 | super(kek); |
| 18 | |
| 19 | this.keyIdentifier = keyIdentifier; |
| 20 | } |
| 21 | |
| 22 | public int hashCode() |
| 23 | { |
| 24 | return Arrays.hashCode(keyIdentifier); |
| 25 | } |
| 26 | |
| 27 | public boolean equals( |
| 28 | Object o) |
| 29 | { |
| 30 | if (!(o instanceof KEKRecipientId)) |
| 31 | { |
| 32 | return false; |
| 33 | } |
| 34 | |
| 35 | KEKRecipientId id = (KEKRecipientId)o; |
| 36 | |
| 37 | return Arrays.areEqual(keyIdentifier, id.keyIdentifier); |
| 38 | } |
| 39 | |
| 40 | public byte[] getKeyIdentifier() |
| 41 | { |
| 42 | return Arrays.clone(keyIdentifier); |
| 43 | } |
| 44 | |
| 45 | public Object clone() |
| 46 | { |
| 47 | return new KEKRecipientId(keyIdentifier); |
| 48 | } |
| 49 | |
| 50 | public boolean match(Object obj) |
| 51 | { |
| 52 | if (obj instanceof byte[]) |
| 53 | { |
| 54 | return Arrays.areEqual(keyIdentifier, (byte[])obj); |
| 55 | } |
| 56 | else if (obj instanceof KEKRecipientInformation) |
| 57 | { |
| 58 | return ((KEKRecipientInformation)obj).getRID().equals(this); |
| 59 | } |
| 60 | |
| 61 | return false; |
| 62 | } |
nothing calls this directly
no outgoing calls
no test coverage detected