mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-25 22:02:05 +01:00
Add method to get keyflags from integer
This commit is contained in:
parent
365382b706
commit
47074e50b9
1 changed files with 13 additions and 0 deletions
|
@ -15,6 +15,9 @@
|
||||||
*/
|
*/
|
||||||
package de.vanitasvitae.crypto.pgpainless.algorithm;
|
package de.vanitasvitae.crypto.pgpainless.algorithm;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.sig.KeyFlags;
|
import org.bouncycastle.bcpg.sig.KeyFlags;
|
||||||
|
|
||||||
public enum KeyFlag {
|
public enum KeyFlag {
|
||||||
|
@ -37,4 +40,14 @@ public enum KeyFlag {
|
||||||
public int getFlag() {
|
public int getFlag() {
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static KeyFlag[] fromInteger(int bitmask) {
|
||||||
|
List<KeyFlag> flags = new ArrayList<>();
|
||||||
|
for (KeyFlag f : KeyFlag.values()) {
|
||||||
|
if ((bitmask & f.flag) != 0) {
|
||||||
|
flags.add(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return flags.toArray(new KeyFlag[]{});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue