Class TlsCryptoUtils
java.lang.Object
org.bouncycastle.tls.crypto.TlsCryptoUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetHash(short hashAlgorithm) static intgetHashForHMAC(int macAlgorithm) static intgetHashForPRF(int prfAlgorithm) static intgetHashInternalSize(int cryptoHashAlgorithm) static intgetHashOutputSize(int cryptoHashAlgorithm) static org.bouncycastle.asn1.ASN1ObjectIdentifiergetOIDForHash(int cryptoHashAlgorithm) static intgetSignature(short signatureAlgorithm) static TlsSecrethkdfExpandLabel(TlsSecret secret, int cryptoHashAlgorithm, String label, byte[] context, int length) HKDF-Expand-Label as defined in RFC 8446 7.1, with the "tls13 " label prefix.static TlsSecrethkdfExpandLabel(TlsSecret secret, int cryptoHashAlgorithm, String label, byte[] context, int length, boolean isDTLS) HKDF-Expand-Label as defined in RFC 8446 7.1, with the label prefix selected by the protocol: "tls13 " for TLS 1.3, or "dtls13" for DTLS 1.3 (RFC 9147 5.9, which requires this for key separation between the two).
-
Constructor Details
-
TlsCryptoUtils
public TlsCryptoUtils()
-
-
Method Details
-
getHash
public static int getHash(short hashAlgorithm) -
getHashForHMAC
public static int getHashForHMAC(int macAlgorithm) -
getHashForPRF
public static int getHashForPRF(int prfAlgorithm) -
getHashInternalSize
public static int getHashInternalSize(int cryptoHashAlgorithm) -
getHashOutputSize
public static int getHashOutputSize(int cryptoHashAlgorithm) -
getOIDForHash
public static org.bouncycastle.asn1.ASN1ObjectIdentifier getOIDForHash(int cryptoHashAlgorithm) -
getSignature
public static int getSignature(short signatureAlgorithm) -
hkdfExpandLabel
public static TlsSecret hkdfExpandLabel(TlsSecret secret, int cryptoHashAlgorithm, String label, byte[] context, int length) throws IOException HKDF-Expand-Label as defined in RFC 8446 7.1, with the "tls13 " label prefix. This is the TLS 1.3 form; for DTLS 1.3 usehkdfExpandLabel(TlsSecret, int, String, byte[], int, boolean), since RFC 9147 5.9 requires the "dtls13" prefix there.- Throws:
IOException
-
hkdfExpandLabel
public static TlsSecret hkdfExpandLabel(TlsSecret secret, int cryptoHashAlgorithm, String label, byte[] context, int length, boolean isDTLS) throws IOException HKDF-Expand-Label as defined in RFC 8446 7.1, with the label prefix selected by the protocol: "tls13 " for TLS 1.3, or "dtls13" for DTLS 1.3 (RFC 9147 5.9, which requires this for key separation between the two).- Parameters:
isDTLS- true to use the DTLS 1.3 label prefix, false for the TLS 1.3 one.- Throws:
IOException
-