01: package org.bouncycastle.bcpg.sig;
02:
03: import org.bouncycastle.bcpg.SignatureSubpacket;
04:
05: /**
06: * packet giving signature creation time.
07: */
08: public class PreferredAlgorithms extends SignatureSubpacket {
09: private static final byte[] intToByteArray(int[] v) {
10: byte[] data = new byte[v.length];
11:
12: for (int i = 0; i != v.length; i++) {
13: data[i] = (byte) v[i];
14: }
15:
16: return data;
17: }
18:
19: public PreferredAlgorithms(int type, boolean critical, byte[] data) {
20: super (type, critical, data);
21: }
22:
23: public PreferredAlgorithms(int type, boolean critical,
24: int[] preferrences) {
25: super (type, critical, intToByteArray(preferrences));
26: }
27:
28: /**
29: * @deprecated mispelt!
30: */
31: public int[] getPreferrences() {
32: return getPreferences();
33: }
34:
35: public int[] getPreferences() {
36: int[] v = new int[data.length];
37:
38: for (int i = 0; i != v.length; i++) {
39: v[i] = data[i] & 0xff;
40: }
41:
42: return v;
43: }
44: }
|