1
package org.bouncycastle.bcpg.sig;
3
import org.bouncycastle.bcpg.SignatureSubpacket;
4
import org.bouncycastle.bcpg.SignatureSubpacketTags;
7
* Packet holding the key flag values.
10
extends SignatureSubpacket
12
public static final int CERTIFY_OTHER = 0x01;
13
public static final int SIGN_DATA = 0x02;
14
public static final int ENCRYPT_COMMS = 0x04;
15
public static final int ENCRYPT_STORAGE = 0x08;
16
public static final int SPLIT = 0x10;
17
public static final int AUTHENTICATION = 0x20;
18
public static final int SHARED = 0x80;
20
private static byte[] intToByteArray(
23
byte[] tmp = new byte[4];
26
for (int i = 0; i != 4; i++)
28
tmp[i] = (byte)(v >> (i * 8));
35
byte[] data = new byte[size + 1];
37
System.arraycopy(tmp, 0, data, 0, data.length);
46
super(SignatureSubpacketTags.KEY_FLAGS, critical, data);
53
super(SignatureSubpacketTags.KEY_FLAGS, critical, intToByteArray(flags));
57
* Return the flag values contained in the first 4 octets (note: at the moment
58
* the standard only uses the first one).
60
* @return flag values.
66
for (int i = 0; i != data.length; i++)
68
flags |= (data[i] & 0xff) << (i * 8);