Package org.yamcs.security.sdls
Interface SdlsSecurityAssociation
- All Known Implementing Classes:
SecurityAssociationAes256Gcm128
public interface SdlsSecurityAssociation
A Security Association (SA) for applying SDLS operations to frames.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe various results of a `processSecurity` operation. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplySecurity(byte[] buffer, int frameStart, int secHeaderStart, int secTrailerEnd, byte[] authMask) intintdefault intbyte[]Get the current sequence number.intprocessSecurity(byte[] buffer, int frameStart, int secHeaderStart, int secTrailerEnd, byte[] authMask) byte[]voidsetSecretKey(byte[] secretKey) Update the secret key used in the SA.voidsetSeqNum(byte[] newSeqNum) Update the sequence number.voidConfigure the Security Association to not verify the sequence number for the next received frame.
-
Method Details
-
getOverheadBytes
default int getOverheadBytes()- Returns:
- the number of bytes of overhead used by the SA (frequently, the sum of the size of the security header and the size of the security trailer).
-
getHeaderSize
int getHeaderSize()- Returns:
- the number of bytes in the security header
-
getTrailerSize
int getTrailerSize()- Returns:
- the number of bytes in the security trailer
-
getKeyLenBits
int getKeyLenBits()- Returns:
- the expected length of the key in bits
-
getAlgorithm
String getAlgorithm()- Returns:
- the name of the algorithm used in the Security Association
-
applySecurity
void applySecurity(byte[] buffer, int frameStart, int secHeaderStart, int secTrailerEnd, byte[] authMask) throws GeneralSecurityException - Parameters:
buffer- the buffer containing the frame, with zero-initialized empty space prepared for the security header and trailer according to `getHeaderSize` and `getTrailerSize`frameStart- the start of the frame as an offset into `buffer`secHeaderStart- the position of the first byte of the security header as an offset into `buffer`secTrailerEnd- the position of the first byte after the security trailer as an offset into `buffer`authMask- the authentication mask to use, covering the whole header and including the mask returned from `securityHdrAuthMask()`- Throws:
GeneralSecurityException- if the security operation fails
-
processSecurity
SdlsSecurityAssociation.VerificationStatusCode processSecurity(byte[] buffer, int frameStart, int secHeaderStart, int secTrailerEnd, byte[] authMask) - Parameters:
buffer- the buffer containing the frameframeStart- the start of the frame as an offset into `buffer`secHeaderStart- the position of the first byte of the security header as an offset into `buffer`secTrailerEnd- the position of the first byte after the security trailer as an offset into `buffer`authMask- the authentication mask to use, covering the whole header and including the mask returned from `securityHdrAuthMask()`- Returns:
- a status code indicating the result of the security operation
-
skipVerifyingNextSeqNum
void skipVerifyingNextSeqNum()Configure the Security Association to not verify the sequence number for the next received frame. -
setSecretKey
void setSecretKey(byte[] secretKey) Update the secret key used in the SA.- Parameters:
secretKey- the new secret key
-
getSeqNum
byte[] getSeqNum()Get the current sequence number.- Returns:
- the sequence number as bytes.
-
setSeqNum
void setSeqNum(byte[] newSeqNum) Update the sequence number.- Parameters:
newSeqNum- the new sequence number as bytes.
-
securityHdrAuthMask
byte[] securityHdrAuthMask()- Returns:
- the authentication mask to use on the security header
-