All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.vault.transit.TransitContext Maven / Gradle / Ivy

There is a newer version: 3.0.0.Beta1
Show newest version
package io.quarkus.vault.transit;

import static io.quarkus.vault.runtime.StringHelper.stringToBytes;

import java.util.Arrays;

/**
 * A transit context used for key derivation, when the key supports it.
 * 
 * @see derived attribute in key creation
 */
public class TransitContext {

    private byte[] context;

    public static TransitContext fromContext(byte[] context) {
        return new TransitContext(context);
    }

    public static TransitContext fromContext(String context) {
        return new TransitContext(stringToBytes(context));
    }

    public TransitContext(byte[] context) {
        this.context = context;
    }

    public byte[] getContext() {
        return context;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        TransitContext that = (TransitContext) o;
        return Arrays.equals(context, that.context);
    }

    @Override
    public int hashCode() {
        return Arrays.hashCode(context);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy