Class StatementSigner
Signs Statements as IEEE 9274.1.1, 4.2.6 "Statement Signing" describes: a JSON Web Signature (RFC 7515,
Compact Serialization, RS256, RS384 or RS512) of the Statement, sent as an Attachment with usage type
SignatureUsageType and content type application/octet-stream.
public static class StatementSigner
- Inheritance
-
StatementSigner
- Inherited Members
Remarks
An LRS checks that the signature is well formed and, when the JWS header carries the signer's certificate
(x5c), that it verifies with that certificate. Whether the signer is trusted is for whoever reads the
Statement to decide.
Properties
SignatureUsageType
The usage type of a signature Attachment, http://adlnet.gov/expapi/attachments/signature.
public static Iri SignatureUsageType { get; }
Property Value
Methods
Sign(Statement, RSA, XapiVersion, HashAlgorithmName, IReadOnlyList<X509Certificate2>?)
Signs a Statement with an RSA private key.
public static SignedStatement Sign(Statement statement, RSA privateKey, XapiVersion version, HashAlgorithmName hashAlgorithm = default, IReadOnlyList<X509Certificate2>? certificateChain = null)
Parameters
statementStatementThe complete Statement to sign. It must not have a signature Attachment yet.
privateKeyRSAThe RSA private key, for example from X509Certificate2's
GetRSAPrivateKey().versionXapiVersionThe xAPI version the Statement is serialized and sent in.
hashAlgorithmHashAlgorithmNameSHA-256, SHA-384 or SHA-512, for the JWS algorithm RS256, RS384 or RS512. The default value means SHA-256.
certificateChainIReadOnlyList<X509Certificate2>The certificate of
privateKeyfollowed by the rest of its chain, put in the JWSx5cheader (4.2.6: should be included when an X.509 certificate is used to sign). Optional.
Returns
- SignedStatement
The Statement with its signature Attachment object, and the signature to send with it.
Exceptions
- ArgumentException
The Statement already has a signature Attachment, the hash algorithm is not one of the three, or the chain contains a null entry.