Example usage for org.bouncycastle.util Arrays copyOf

List of usage examples for org.bouncycastle.util Arrays copyOf

Introduction

In this page you can find the example usage for org.bouncycastle.util Arrays copyOf.

Prototype

public static BigInteger[] copyOf(BigInteger[] original, int newLength) 

Source Link

Usage

From source file:com.github.horrorho.inflatabledonkey.data.backup.BackupAccount.java

License:Open Source License

public BackupAccount(CloudKit.Record record, Optional<byte[]> hmacKey, Collection<DeviceID> devices) {
    super(record);
    this.hmacKey = hmacKey.map(bs -> Arrays.copyOf(bs, bs.length));
    this.devices = new ArrayList<>(devices);
}

From source file:com.github.horrorho.inflatabledonkey.data.backup.BackupAccount.java

License:Open Source License

public Optional<byte[]> hmacKey() {
    return hmacKey.map(bs -> Arrays.copyOf(bs, bs.length));
}

From source file:com.github.horrorho.inflatabledonkey.data.backup.KeyBag.java

License:Open Source License

public KeyBag(KeyBagID keyBagID, KeyBagType type, Map<Integer, byte[]> publicKeys,
        Map<Integer, byte[]> privateKeys) {

    this.keyBagID = Objects.requireNonNull(keyBagID);
    this.type = Objects.requireNonNull(type, "type");
    this.publicKeys = publicKeys.entrySet().stream().collect(
            Collectors.toMap(Map.Entry::getKey, bs -> Arrays.copyOf(bs.getValue(), bs.getValue().length)));
    this.privateKeys = privateKeys.entrySet().stream().collect(
            Collectors.toMap(Map.Entry::getKey, u -> Arrays.copyOf(u.getValue(), u.getValue().length)));
}

From source file:com.github.horrorho.inflatabledonkey.data.backup.KeyBag.java

License:Open Source License

public Optional<byte[]> publicKey(int protectionClass) {
    return Optional.ofNullable(publicKeys.get(protectionClass)).map(k -> Arrays.copyOf(k, k.length));
}

From source file:com.github.horrorho.inflatabledonkey.data.backup.KeyBag.java

License:Open Source License

public Optional<byte[]> privateKey(int protectionClass) {
    return Optional.ofNullable(privateKeys.get(protectionClass)).map(k -> Arrays.copyOf(k, k.length));
}

From source file:com.github.horrorho.inflatabledonkey.data.backup.KeyBagID.java

License:Open Source License

public KeyBagID(byte[] uuid) {
    this.uuid = Arrays.copyOf(uuid, uuid.length);
    uuidBase64 = Base64.getEncoder().encodeToString(uuid);
}

From source file:com.github.horrorho.inflatabledonkey.data.backup.KeyBagID.java

License:Open Source License

public byte[] uuid() {
    return Arrays.copyOf(uuid, uuid.length);
}

From source file:com.github.horrorho.inflatabledonkey.data.backup.TagLengthValue.java

License:Open Source License

public byte[] value() {
    return Arrays.copyOf(value, value.length);
}

From source file:com.github.horrorho.inflatabledonkey.data.blob.BlobA4.java

License:Open Source License

BlobA4(int x, byte[] tag, byte[] uid, byte[] salt, byte[] ephemeralKey) {
    if (tag.length != 0x10) {
        throw new IllegalArgumentException("bad tag 0x" + Hex.toHexString(tag));
    }// w  ww  .ja  v a2  s. c  o m

    this.x = x;
    this.tag = Arrays.copyOf(tag, 0x10);
    this.uid = Arrays.copyOf(uid, uid.length);
    this.salt = Arrays.copyOf(salt, salt.length);
    this.ephemeralKey = Arrays.copyOf(ephemeralKey, ephemeralKey.length);
}

From source file:com.github.horrorho.inflatabledonkey.data.blob.BlobA4.java

License:Open Source License

public byte[] tag() {
    return Arrays.copyOf(tag, tag.length);
}