Class CoseService

java.lang.Object
io.jans.fido2.service.CoseService

@ApplicationScoped public class CoseService extends Object
Utility classes for COSE key structure.
  • Constructor Details

    • CoseService

      public CoseService()
  • Method Details

    • getCodeCurve

      public int getCodeCurve(com.fasterxml.jackson.databind.JsonNode uncompressedECPointNode)
    • isDecodable

      public boolean isDecodable(int algorithm)
      Whether this service can build a public key for the given COSE algorithm code point. The advertised algorithm set is filtered through this, so we never offer an algorithm in pubKeyCredParams whose credentials we would then fail to decode.
    • createUncompressedPointFromCOSEPublicKey

      public PublicKey createUncompressedPointFromCOSEPublicKey(com.fasterxml.jackson.databind.JsonNode uncompressedECPointNode)
    • convertRawKeyToMLDSAKey

      public PublicKey convertRawKeyToMLDSAKey(CoseMLDSAAlgorithm algorithm, byte[] rawKey)
      Rebuilds an ML-DSA public key from the raw COSE AKP parameter, by wrapping it in the SubjectPublicKeyInfo structure KeyFactory expects. The key is produced with the same provider SignatureVerifier uses, so a deployment whose provider lacks ML-DSA fails here rather than later - and because the advertised set is derived from that same capability, such a deployment never offers it.
    • convertRawKeyToEdDSAKey

      public PublicKey convertRawKeyToEdDSAKey(int curve, byte[] rawKey)
      Rebuilds an Edwards-curve public key from the raw COSE OKP parameters, by wrapping the raw key in the SubjectPublicKeyInfo structure KeyFactory expects. The key is produced with the same provider SignatureVerifier uses, so it stays valid on the FIPS build variant.
    • convertUncompressedPointToECKey

      public ECPublicKey convertUncompressedPointToECKey(byte[] uncompressedPoint, int curve)
    • getPublicKeyFromUncompressedECPoint

      public PublicKey getPublicKeyFromUncompressedECPoint(byte[] uncompressedECPointCOSEPubKey)
    • convertECKeyToUncompressedPoint

      public com.fasterxml.jackson.databind.JsonNode convertECKeyToUncompressedPoint(byte[] encodedPublicKey)
    • toUncompressedCoord

      public static byte[] toUncompressedCoord(byte[] coord, int keySizeBytes)
    • decodePublicKey

      public PublicKey decodePublicKey(byte[] encodedPublicKey) throws io.jans.as.model.exception.SignatureException
      Throws:
      io.jans.as.model.exception.SignatureException