Simple certificate authority service based on OpenSSL and OpenSSL GOST engine
145
https://github.com/alrdevelop/caserv
You must create database and provide connection string to environment variable:
Example (defaulValue):
postgresql://admin:[email protected]:5432/postgres
PostgreSQL:
CREATE TABLE IF NOT EXISTS public.ca (
"serial" varchar(250) NOT NULL,
"thumbprint" varchar(250) NOT NULL,
"commonName" varchar(500) NOT NULL,
"issueDate" timestamp with time zone NOT NULL,
"certificate" bytea NOT NULL,
"privateKey" bytea NOT NULL,
"publicUrl" varchar(500) NOT NULL,
CONSTRAINT ca_serial_pk PRIMARY KEY ("serial"),
CONSTRAINT ca_unique_thumbprint UNIQUE ("thumbprint")
);
CREATE TABLE IF NOT EXISTS public.certificates (
"serial" varchar(250) NOT NULL,
"thumbprint" varchar(250) NOT NULL,
"caSerial" varchar(250) NOT NULL,
"commonName" varchar(500) NOT NULL,
"issueDate" timestamp with time zone NOT NULL,
"revokeDate" timestamp with time zone NULL,
CONSTRAINT certificates_pk PRIMARY KEY ("serial"),
CONSTRAINT certificates_unique_thumbprint UNIQUE ("thumbprint"),
CONSTRAINT certificates_ca_fk FOREIGN KEY ("caSerial") REFERENCES public.ca("serial")
);
CREATE TABLE IF NOT EXISTS public.crl (
"caSerial" varchar(250) NOT NULL,
"number" integer NOT NULL,
"issueDate" timestamp with time zone NOT NULL,
"expireDate" timestamp with time zone NOT NULL,
"lastSerial" varchar(250) NULL,
"content" bytea NOT NULL,
CONSTRAINT crl_pk PRIMARY KEY ("caSerial","number")
);
algorithmEnum:
subjectTypeEnum:
{
serial : string
thumbprint : string
caSerial : string
commonName : string
issueDate : datetime
}
{
serial : string
thumbprint : string
caSerial : string
commonName : string
issueDate : datetime
revokeDate : datetime
}
{[{
serial : string
thumbprint : string
caSerial : string
commonName : string
issueDate : datetime
revokeDate : datetime
},..]}
Create CA certificicate. Input model:
{
algorithm : algorithmEnum
country : string
localityName : string
stateOrProvinceName : string
streetAddress : string
emailAddress : string
innLe : string
ogrn : string
organizationName : string
ttlInDays : int
publicUrl : string
}
PublicUrl used for certficate distribution points (CRL, CRT access). You CSP must have access to this URL. URL must be in next format http://example.com do not use back slash at end of URL (http://example.com/).
Example:
СURL request:
curl -X POST http://localhost:8080/ca/create/ -H 'Content-Type: application/json' -d '{"country" : "RU", "stateOrProvinceName" : "78 г.Санкт-Петербург", "localityName" : "Санкт-Петербург", "streetAddress" : "ул. Большая Морская", "emailAddress" : "[email protected]", "innLe" : "1234567890", "ogrn" : "1234567890123", "organizationName" : "ООО Очень Тестовый УЦ", "publicUrl" : "http://localhost:8080", "algorithm" : 1, "ttlInDays" : 3650}'
Issue client certificicate.
{
subjectType : subjectTypeEnum
algorithm : algorithmEnum
ttlInDays : int
country : string
localityName : string
stateOrProvinceName : string
streetAddress : string
emailAddress : string
inn : string
snils : string
givenName : string
surname : string
ogrnip : string
innLe : string
ogrn : string
organizationName : string
organizationUnitName : string
title : string
pin : string
}
If success, returns PKCS12 container file
Example: СURL request:
curl -X POST http://localhost:8080/ca/D8B3F0B524C07A2E6BFD533EF6C23F52/issue/ -H 'Content-Type: application/json' -d '{ "commonName" : "ООО Рога и Копыта", "country" : "RU", "stateOrProvinceName" : "78 г.Санкт-Петербург", "localityName" : "Санкт-Петербург", "streetAddress" : "ул. Пушкина", "emailAddress" : "[email protected]", "inn" : "123456789012", "givenName" : "Иван Иванович", "surname" : "Иванов", "snils" : "12334536322", "innLe" : "2234467890", "ogrn" : "2224567890123", "organizationName" : "ООО Рога и Копыта", "organizationUnitName" : "Директорат", "title" : "Предводитель", "algorithm" : 0, "subjectType" : 2, "ttlInDays" : 365, "pin" : "you_secret_pin_for_pfx"}' --output test.pfx
Subject type 0:
{
"subjectType" : 0
"algorithm" : 0
"ttlInDays" : 365
"country" : "RU",
"localityName" : "Saint Petersburg",
"stateOrProvinceName" : "78 Saint Petersburg",
"streetAddress" : "Bolshaya Morskaya",
"emailAddress" : "mail@mail",
"inn" : "123456789012",
"snils" : "12334536322",
"givenName" : "Ivan Ivanovich",
"surname" : "Ivanov",
"pin" : "you_secret_pin_for_pfx"
}
Subject type 1:
{
"subjectType" : 1
"algorithm" : 0
"ttlInDays" : 365
"country" : "RU",
"localityName" : "Saint Petersburg",
"stateOrProvinceName" : "78 Saint Petersburg",
"streetAddress" : "Bolshaya Morskaya",
"emailAddress" : "mail@mail",
"inn" : "123456789012",
"snils" : "12334536322",
"givenName" : "Ivan Ivanovich",
"surname" : "Ivanov",
"ogrnip" : "2224567890123",
"organizationName" : "IP Ivanov Inan Ivanovich",
"pin" : "you_secret_pin_for_pfx"
}
Subject type 2:
{
"subjectType" : 2,
"algorithm" : 0,
"ttlInDays" : 365,
"country" : "RU",
"localityName" : "Saint Petersburg",
"stateOrProvinceName" : "78 Saint Petersburg",
"streetAddress" : "Bolshaya Morskaya",
"emailAddress" : "mail@mail",
"inn" : "123456789012",
"snils" : "12334536322",
"givenName" : "Ivan Ivanovich",
"surname" : "Ivanov",
"innLe" : "1234567890",
"ogrn" : "2224567890123",
"organizationName" : "OOO Roga i kopita",
"organizationUnitName" : "",
"title" : "CEO",
"pin" : "you_secret_pin_for_pfx"
}
Revoke client certificicate. Input model:
{
"serial" : "string"
}
Content type
Image
Digest
sha256:a2a775e5b…
Size
477 MB
Last updated
over 1 year ago
docker pull alrdev/caserver:0.1.2