Class AltsTsiHandshaker
java.lang.Object
io.grpc.alts.internal.AltsTsiHandshaker
- All Implemented Interfaces:
TsiHandshaker
Negotiates a grpc channel key to be used by the TsiFrameProtector, using ALTs handshaker service.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AltsHandshakerClientprivate final booleanprivate final io.grpc.ChannelLoggerprivate ByteBufferstatic final String -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)AltsTsiHandshaker(boolean isClient, AltsHandshakerClient handshaker, io.grpc.ChannelLogger logger) privateAltsTsiHandshaker(boolean isClient, HandshakerServiceGrpc.HandshakerServiceStub stub, AltsHandshakerOptions options, io.grpc.ChannelLogger logger) Starts a new TSI handshaker with client options. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes resources.createFrameProtector(int maxFrameSize, io.netty.buffer.ByteBufAllocator alloc) Creates a frame protector from a completed handshake.createFrameProtector(io.netty.buffer.ByteBufAllocator alloc) Creates a frame protector from a completed handshake.Returns the peer extracted from a completed handshake.Returns the peer extracted from a completed handshake.voidgetBytesToSendToPeer(ByteBuffer bytes) Gets bytes that need to be sent to the peer.booleanReturns true if and only if the handshake is still in progress.static TsiHandshakernewClient(HandshakerServiceGrpc.HandshakerServiceStub stub, AltsHandshakerOptions options, io.grpc.ChannelLogger logger) Creates a new TsiHandshaker for use by the client.static TsiHandshakernewServer(HandshakerServiceGrpc.HandshakerServiceStub stub, AltsHandshakerOptions options, io.grpc.ChannelLogger logger) Creates a new TsiHandshaker for use by the server.booleanprocessBytesFromPeer(ByteBuffer bytes) Process the bytes received from the peer.
-
Field Details
-
logger
private final io.grpc.ChannelLogger logger -
TSI_SERVICE_ACCOUNT_PEER_PROPERTY
- See Also:
-
isClient
private final boolean isClient -
handshaker
-
outputFrame
-
-
Constructor Details
-
AltsTsiHandshaker
private AltsTsiHandshaker(boolean isClient, HandshakerServiceGrpc.HandshakerServiceStub stub, AltsHandshakerOptions options, io.grpc.ChannelLogger logger) Starts a new TSI handshaker with client options. -
AltsTsiHandshaker
AltsTsiHandshaker(boolean isClient, AltsHandshakerClient handshaker, io.grpc.ChannelLogger logger)
-
-
Method Details
-
processBytesFromPeer
Process the bytes received from the peer.- Specified by:
processBytesFromPeerin interfaceTsiHandshaker- Parameters:
bytes- The buffer containing the handshake bytes from the peer.- Returns:
- true, if the handshake has all the data it needs to process and false, if the method must be called again to complete processing.
- Throws:
GeneralSecurityException
-
extractPeer
Returns the peer extracted from a completed handshake.- Specified by:
extractPeerin interfaceTsiHandshaker- Returns:
- the extracted peer.
- Throws:
GeneralSecurityException
-
extractPeerObject
Returns the peer extracted from a completed handshake.- Specified by:
extractPeerObjectin interfaceTsiHandshaker- Returns:
- the extracted peer.
- Throws:
GeneralSecurityException
-
newClient
public static TsiHandshaker newClient(HandshakerServiceGrpc.HandshakerServiceStub stub, AltsHandshakerOptions options, io.grpc.ChannelLogger logger) Creates a new TsiHandshaker for use by the client. -
newServer
public static TsiHandshaker newServer(HandshakerServiceGrpc.HandshakerServiceStub stub, AltsHandshakerOptions options, io.grpc.ChannelLogger logger) Creates a new TsiHandshaker for use by the server. -
getBytesToSendToPeer
Gets bytes that need to be sent to the peer.- Specified by:
getBytesToSendToPeerin interfaceTsiHandshaker- Parameters:
bytes- The buffer to put handshake bytes.- Throws:
GeneralSecurityException
-
isInProgress
public boolean isInProgress()Returns true if and only if the handshake is still in progress.- Specified by:
isInProgressin interfaceTsiHandshaker- Returns:
- true, if the handshake is still in progress, false otherwise.
-
createFrameProtector
public TsiFrameProtector createFrameProtector(int maxFrameSize, io.netty.buffer.ByteBufAllocator alloc) Creates a frame protector from a completed handshake. No other methods may be called after the frame protector is created.- Specified by:
createFrameProtectorin interfaceTsiHandshaker- Parameters:
maxFrameSize- the requested max frame size, the callee is free to ignore.alloc- used for allocating ByteBufs.- Returns:
- a new TsiFrameProtector.
-
createFrameProtector
Creates a frame protector from a completed handshake. No other methods may be called after the frame protector is created.- Specified by:
createFrameProtectorin interfaceTsiHandshaker- Parameters:
alloc- used for allocating ByteBufs.- Returns:
- a new TsiFrameProtector.
-
close
public void close()Description copied from interface:TsiHandshakerCloses resources.- Specified by:
closein interfaceTsiHandshaker
-