27 lines
911 B
C#
27 lines
911 B
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using static StellaOps.Localization.T;
|
|
|
|
namespace StellaOps.Cryptography.Kms;
|
|
|
|
public sealed partial class Fido2KmsClient
|
|
{
|
|
public async Task<KmsKeyMaterial> ExportAsync(string keyId, string? keyVersion, CancellationToken cancellationToken = default)
|
|
{
|
|
ThrowIfDisposed();
|
|
|
|
var metadata = await GetMetadataAsync(keyId, cancellationToken).ConfigureAwait(false);
|
|
|
|
return new KmsKeyMaterial(
|
|
metadata.KeyId,
|
|
metadata.KeyId,
|
|
metadata.Algorithm,
|
|
_curveName,
|
|
Array.Empty<byte>(),
|
|
_publicParameters.Q.X ?? throw new InvalidOperationException(_t("crypto.fido2.missing_x")),
|
|
_publicParameters.Q.Y ?? throw new InvalidOperationException(_t("crypto.fido2.missing_y")),
|
|
_options.CreatedAt ?? _timeProvider.GetUtcNow());
|
|
}
|
|
}
|