Package com.google.protobuf

Examples of com.google.protobuf.ByteString.toByteArray()


      RollWALWriterResponse response = admin.rollWALWriter(null, request);
      int regionCount = response.getRegionToFlushCount();
      byte[][] regionsToFlush = new byte[regionCount][];
      for (int i = 0; i < regionCount; i++) {
        ByteString region = response.getRegionToFlush(i);
        regionsToFlush[i] = region.toByteArray();
      }
      return regionsToFlush;
    } catch (ServiceException se) {
      throw ProtobufUtil.getRemoteException(se);
    }
View Full Code Here


    }

    @Override
    public void writeValue(Object o, ProtobufWriter json) throws IOException {
        ByteString v = (ByteString) o;
        String s = BaseEncoding.base16().encode(v.toByteArray());
        json.value(s);
    }

    @Override
    public Object readValue(JsonReader json) throws IOException {
View Full Code Here

        }

        ByteString hash = ByteString.copyFrom(md5.hash().asBytes());

        if (!file.getHash().equals(hash)) {
            log.warn("Hash mismatch: {} vs {}", Hex.toHex(file.getHash().toByteArray()), Hex.toHex(hash.toByteArray()));
            throw new IllegalStateException("Hash mismatch");
        }
    }

    @Override
View Full Code Here

            BlobData blob = imageDataService.getImageFile(cookie);

            response = Response.ok().entity(blob.asEntity());

            ByteString md5 = blob.getHash();
            response.header("Content-MD5", Hex.toHex(md5.toByteArray()));
        } else {
            response = Response.status(Status.NO_CONTENT);
        }

        setHttpHeaders(image, response);
View Full Code Here

                if (clientCertificate != null) {
                    // Request for challenge
                    ByteString challenge = loginService.getChallenge(clientCertificate);
                    if (challenge != null) {
                        V2AuthResponse response = new V2AuthResponse();
                        response.challenge = BaseEncoding.base64().encode(challenge.toByteArray());
                        return response;
                    }

                }
            }
View Full Code Here

    public UserWithSecret getFromToken(UserData user, TokenInfo token) throws KeyczarException {
        byte[] tokenKeySerialized;
        try {
            ByteString tokenSecret = token.getTokenSecret();
            tokenKeySerialized = getCrypter().decrypt(tokenSecret.toByteArray());
        } catch (KeyczarException e) {
            // This should have been validated
            log.warn("Error decrypting user key");
            return null;
        }
View Full Code Here

        }

        if (version == 1) {
            AesKey projectKey;
            try {
                projectKey = KeyczarUtils.unpack(projectKeyBytes.toByteArray());
            } catch (KeyczarException e) {
                throw new IllegalStateException("Error reading project key", e);
            }
            SecretToken token = new SecretToken(SecretTokenType.PROJECT_SECRET, projectKey, null);
            return new AuthenticatedProject(project, token);
View Full Code Here

            // TODO: Encrypt?? I think this would need a commutative encryption
            // algorithm.
            // We could also return a pair of challenges, one repeated, one not.

            return ByteString.copyFrom(ChallengeResponses.addHeader(ciphertext.toByteArray()));
        }

        log.warn("Unable to build auth challenge for credential: {}", credential);

        return null;
View Full Code Here

        if (request.challengeResponse == null || Strings.isNullOrEmpty(request.challengeResponse.response)) {
            ByteString challenge = loginService.createRegistrationChallenge(clientCertificate);

            RegisterResponse response = new RegisterResponse();
            response.challenge = BaseEncoding.base64().encode(challenge.toByteArray());
            return response;
        }

        DomainData domain = identityService.getDefaultDomain();
View Full Code Here

        // We allow multiple systems to share an email address
        // so we use the public key hash as our unique id
        {
            ByteString publicKeySha1 = clientCertificate.getPublicKeySha1();
            String hex = BaseEncoding.base16().encode(publicKeySha1.toByteArray());
            b.setName("__pubkey__" + hex);
        }

        b.setDomainId(domain.getId());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.