Search in sources :

Example 1 with GetIndicesResponse

use of com.google.nigori.common.NigoriMessages.GetIndicesResponse in project nigori by ucam-cl-dtg.

the class CryptoNigoriDatastore method getIndices.

@Override
public List<Index> getIndices() throws NigoriCryptographyException, IOException, UnauthorisedException {
    try {
        GetIndicesResponse getResponse = protocol.getIndices(MessageLibrary.getIndicesRequestAsProtobuf(keyManager.getServerName(), keyManager.signer()));
        if (getResponse == null) {
            return null;
        }
        List<ByteString> indices = getResponse.getIndicesList();
        List<Index> answer = new ArrayList<Index>(indices.size());
        for (ByteString index : indices) {
            answer.add(new Index(keyManager.decrypt(index.toByteArray())));
        }
        return answer;
    } catch (NotFoundException e) {
        return null;
    }
}
Also used : GetIndicesResponse(com.google.nigori.common.NigoriMessages.GetIndicesResponse) ByteString(com.google.protobuf.ByteString) ArrayList(java.util.ArrayList) NotFoundException(com.google.nigori.common.NotFoundException) Index(com.google.nigori.common.Index)

Aggregations

Index (com.google.nigori.common.Index)1 GetIndicesResponse (com.google.nigori.common.NigoriMessages.GetIndicesResponse)1 NotFoundException (com.google.nigori.common.NotFoundException)1 ByteString (com.google.protobuf.ByteString)1 ArrayList (java.util.ArrayList)1