01: package org.bouncycastle.bcpg.sig;
02:
03: import org.bouncycastle.bcpg.SignatureSubpacket;
04: import org.bouncycastle.bcpg.SignatureSubpacketTags;
05:
06: /**
07: * packet giving whether or not the signature is signed using the primary user ID for the key.
08: */
09: public class PrimaryUserID extends SignatureSubpacket {
10: private static final byte[] booleanToByteArray(boolean value) {
11: byte[] data = new byte[1];
12:
13: if (value) {
14: data[0] = 1;
15: return data;
16: } else {
17: return data;
18: }
19: }
20:
21: public PrimaryUserID(boolean critical, byte[] data) {
22: super (SignatureSubpacketTags.PRIMARY_USER_ID, critical, data);
23: }
24:
25: public PrimaryUserID(boolean critical, boolean isPrimaryUserID) {
26: super (SignatureSubpacketTags.PRIMARY_USER_ID, critical,
27: booleanToByteArray(isPrimaryUserID));
28: }
29:
30: public boolean isPrimaryUserID() {
31: return data[0] != 0;
32: }
33: }
|