@Test public void testLoadMalformedRawPublicKey() { byte[] rawPublicKey = "malformed raw public key".getBytes(); try { encrypterManager.rawLoadPublicKey(rawPublicKey); fail("Did not throw GeneralSecurityException"); } catch (GeneralSecurityException e) { } }
@Override HybridEncrypt rawLoadPublicKey(byte[] publicKey) throws GeneralSecurityException { WrappedWebPushPublicKey wrappedWebPushPublicKey; try { wrappedWebPushPublicKey = WrappedWebPushPublicKey.parseFrom(publicKey); } catch (InvalidProtocolBufferException e) { throw new GeneralSecurityException("unable to parse public key", e); } return new WebPushHybridEncrypt.Builder() .withAuthSecret(wrappedWebPushPublicKey.getAuthSecret().toByteArray()) .withRecipientPublicKey(wrappedWebPushPublicKey.getKeyBytes().toByteArray()) .build(); }
WebPushEncrypterManager extends EncrypterManager { @Override HybridEncrypt rawLoadPublicKey(byte[] publicKey) throws GeneralSecurityException { WrappedWebPushPublicKey wrappedWebPushPublicKey; try { wrappedWebPushPublicKey = WrappedWebPushPublicKey.parseFrom(publicKey); } catch (InvalidProtocolBufferException e) { throw new GeneralSecurityException("unable to parse public key", e); } return new WebPushHybridEncrypt.Builder() .withAuthSecret(wrappedWebPushPublicKey.getAuthSecret().toByteArray()) .withRecipientPublicKey(wrappedWebPushPublicKey.getKeyBytes().toByteArray()) .build(); } }
WebPushEncrypterManager extends EncrypterManager { @Override HybridEncrypt rawLoadPublicKey(byte[] publicKey) throws GeneralSecurityException { WrappedWebPushPublicKey wrappedWebPushPublicKey; try { wrappedWebPushPublicKey = WrappedWebPushPublicKey.parseFrom(publicKey); } catch (InvalidProtocolBufferException e) { throw new GeneralSecurityException("unable to parse public key", e); } return new WebPushHybridEncrypt.Builder() .withAuthSecret(wrappedWebPushPublicKey.getAuthSecret().toByteArray()) .withRecipientPublicKey(wrappedWebPushPublicKey.getKeyBytes().toByteArray()) .build(); }  }
WebPushEncrypterManager extends EncrypterManager { @Override HybridEncrypt rawLoadPublicKey(byte[] publicKey) throws GeneralSecurityException { WrappedWebPushPublicKey wrappedWebPushPublicKey; try { wrappedWebPushPublicKey = WrappedWebPushPublicKey.parseFrom(publicKey); } catch (InvalidProtocolBufferException e) { throw new GeneralSecurityException("unable to parse public key", e); } return new WebPushHybridEncrypt.Builder() .withAuthSecret(wrappedWebPushPublicKey.getAuthSecret().toByteArray()) .withRecipientPublicKey(wrappedWebPushPublicKey.getKeyBytes().toByteArray()) .build(); }   }
WebPushEncrypterManager extends EncrypterManager { @Override HybridEncrypt rawLoadPublicKey(byte[] publicKey) throws GeneralSecurityException { WrappedWebPushPublicKey wrappedWebPushPublicKey; try { wrappedWebPushPublicKey = WrappedWebPushPublicKey.parseFrom(publicKey); } catch (InvalidProtocolBufferException e) { throw new GeneralSecurityException("unable to parse public key", e); } return new WebPushHybridEncrypt.Builder() .withAuthSecret(wrappedWebPushPublicKey.getAuthSecret().toByteArray()) .withRecipientPublicKey(wrappedWebPushPublicKey.getKeyBytes().toByteArray()) .build(); }    }