Árvore de páginas


Função que salva o certificado digital e a chave privada no diretório de configuração do SAML e depois altera o arquivo de configuração do SAML para utilizar estes certificados.

setSPCert( <certFilename>, <certBuffer>, <keyFilename>, <keyBuffer>, [@errorMsg] ) --> flag

 

NomeTipoDescriçãoObrigatórioReferência
certFilenameCaracterNome do arquivo onde será salvo o buffer que contém o certificado.X 
certBufferCaracterBuffer que contém o certificado a ser utilizado pelo SP.X 
keyFilenameCaracterNome do arquivo onde será salvo o buffer que contém a chave privada.X 
keyBufferCaracterBuffer que contém a chave privada a ser utilizada pelo SP.X 
errorMsgCaracterEm caso de erro, esta variável será preenchida com a descrição do erro. X

 

Retorno

flag (Lógico)
  • Retorna verdadeiro (.T.) em caso de sucesso; caso contrário, falso (.F.).

 

static function getCert()
  certificate := "-----BEGIN CERTIFICATE-----" + CRLF;
  + "MIIC7jCCAdagAwIBAgIJAId3b8yf3qBfMA0GCSqGSIb3DQEBBQUAMBgxFjAUBgNV" + CRLF;
  + "BAMTDXRlYy1sdmluaWNpdXMwHhcNMTIxMTIyMTk1MTEwWhcNMjIxMTIwMTk1MTEw" + CRLF;
  + "WjAYMRYwFAYDVQQDEw10ZWMtbHZpbmljaXVzMIIBIjANBgkqhkiG9w0BAQEFAAOC" + CRLF;
  + "AQ8AMIIBCgKCAQEAs+VCZmdnRg+YrN3rMl1IiNT0kpqCD6LrEU9Inw8rPSQ7uoJx" + CRLF;
  + "2wVfLSvzoMueHV7A2/GWEEQFRqJ8gyPvdO7ahJ60RzVKHAKiR/p5l2ONct7vXRVs" + CRLF;
  + "jn3ZHe0au4s1Zhx0nLaveHa3uFqbuKkvcfHz1jGmjxFF3Hgcz+wWp1qvKQWGSEzh" + CRLF;
  + "89ANkmVrMwyZVm+QiELSeSbF2dy+P5ymVUZ3/0sVrLW9IbCr/2SH3O0ID2PgNlPp" + CRLF;
  + "dyxFcwCqII58cbfRjkm2Hs71InRC8nRjeRdNlWmMYzYtnzuI5i7rA6Rn81I20LcT" + CRLF;
  + "duneyMEVqR0uwCbBrW8hE14CloO6xNtJczMMCwIDAQABozswOTAYBgNVHREEETAP" + CRLF;
  + "gg10ZWMtbHZpbmljaXVzMB0GA1UdDgQWBBRN+g35SDc5ugbtgbkDZ9hvLLcjezAN" + CRLF;
  + "BgkqhkiG9w0BAQUFAAOCAQEAQwdtDbpn0OQYCCUjZTLR9Bs6v3vZqlgWYfnfHoGw" + CRLF;
  + "AXHrOpjcWis85wdyEQjeE2+KcKB9mGgG2LphG9mBrfCf1BVPzENkQUnS6AqVhuJe" + CRLF;
  + "KE2mlavNONOygWmG4wQQJQBljSZyVaSL0Asdy2sDMa7v66n+qiqj+hY3JTKVYlbF" + CRLF;
  + "lJDl+POkh784T6C0OXO0XzOYpzCvyrj4lQXAZC5Vfiex30vJs6a9RuhwwSVy/BNL" + CRLF;
  + "BDDKnyLb+2KfysVecKdwEmymNNTK1pzK5VBslH6v8e7cI2bQ2aXDpb1tnKwtNxm+" + CRLF;
  + "COl5peOveKURXr1oFWXWYMbL/9/ziLkX92/60uZDfDAKCQ==" + CRLF;
  + "-----END CERTIFICATE-----"
return certificate

static function getPrivKey()
  privKey := "-----BEGIN RSA PRIVATE KEY-----" + CRLF;
  + "MIIEpAIBAAKCAQEAs+VCZmdnRg+YrN3rMl1IiNT0kpqCD6LrEU9Inw8rPSQ7uoJx" + CRLF;
  + "2wVfLSvzoMueHV7A2/GWEEQFRqJ8gyPvdO7ahJ60RzVKHAKiR/p5l2ONct7vXRVs" + CRLF;
  + "jn3ZHe0au4s1Zhx0nLaveHa3uFqbuKkvcfHz1jGmjxFF3Hgcz+wWp1qvKQWGSEzh" + CRLF;
  + "89ANkmVrMwyZVm+QiELSeSbF2dy+P5ymVUZ3/0sVrLW9IbCr/2SH3O0ID2PgNlPp" + CRLF;
  + "dyxFcwCqII58cbfRjkm2Hs71InRC8nRjeRdNlWmMYzYtnzuI5i7rA6Rn81I20LcT" + CRLF;
  + "duneyMEVqR0uwCbBrW8hE14CloO6xNtJczMMCwIDAQ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+CtGBIJYno" + CRLF;
  + "08KF2karRA8wRk3PXWOxRMjt9XeMJVxeTHimKHT/7onxbH2JNwFuQsCjteCi5vCo" + CRLF;
  + "4N5wgre+mSVlurlyNXQvBdjwBPTqOoIlvPDWIqqTzzi667fZrAAnb8Vno9hKAYkG" + CRLF;
  + "XO000xECgYACur0xK1nXv+95NcodafMLcoonkDbNHJNfCXWDyYOYqCdPj6kVkFtE" + CRLF;
  + "U52RZ2jfby/S4vOyGirn9c4xSI6jzwCL/P6xVoUbmNl9iCEUtPWdofnpBaicVdSf" + CRLF;
  + "fcPURtz8r4tZSVCQ/YljPvsdKCl1wVBAN0hyMZPeU4BZ1zIvXZpbQw==" + CRLF;
  + "-----END RSA PRIVATE KEY-----"
return privKey

static function tstSPCert() 
  local error
  if setSPCert("certfile.txt", getCert(), "keyfile.txt", getPrivKey(), @error) == .F.
    return alert("setSPCert: " + error)
  endif
return

 

Protheus 10 , TOTVS Application Server 10 , ByYou Application Server

 

  • Sem rótulos