private void ValidateEcParameters() { if (JwkHelper.IsEC(KeyType) && string.IsNullOrEmpty(CurveName)) { throw new AzPSArgumentException(Resources.EcButNoCurveName, nameof(CurveName)); } if (!string.IsNullOrEmpty(CurveName) && !JwkHelper.IsEC(KeyType)) { throw new AzPSArgumentException(Resources.CurveNameButNotEc, nameof(KeyType)); } }
public Track1Sdk.JsonWebKey ConvertKeyFromFile(FileInfo fileInfo, SecureString password, WebKeyConverterExtraInfo extraInfo = null) { if (CanProcess(fileInfo)) { var jwk = Convert(fileInfo.FullName); if (JwkHelper.IsEC(extraInfo?.KeyType)) { jwk.Kty = JsonWebKeyType.EllipticCurveHsm; // byok -> hsm jwk.CurveName = extraInfo.CurveName; } return(jwk); } else if (next != null) { return(next.ConvertKeyFromFile(fileInfo, password, extraInfo)); } else { throw new ArgumentException(string.Format(KeyVaultProperties.Resources.UnsupportedFileFormat, fileInfo.Name)); } }