Skip to content

Errore apertura certificati #2

@sommafa

Description

@sommafa

Ciao,
ho generato un certificato usando la documentazione a corredo del PDND (https://docs.pagopa.it/interoperabilita-1/manuale-operativo/client-e-materiale-crittografico#generare-il-materiale-crittografico).

Per poter leggere la chiave primaria (il file PEM generato) nel tuo codice, ho dovuto modificare la funzione GetSecurityParameters in questo modo:

private RSAParameters GetSecurityParameters(string keyPath)
{
    RSAParameters rsaParams;
    using (var tr = new StringReader(File.ReadAllText(keyPath).Trim()))
    {
        var pemReader = new PemReader(tr);
        var keyPair = pemReader.ReadObject() as RsaPrivateCrtKeyParameters;
        if (keyPair == null)
        {
            throw new Exception("Could not read RSA private key");
        }
        rsaParams = DotNetUtilities.ToRSAParameters(keyPair);
    }

    return rsaParams;
}

ti torna questa modifica?

grazie

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions