Ja jebe fiński stream xDD
#ksw
#ksw
W zwyczajach Japończyków funkcjonuje praktyka „kąpieli leśnych”. Polega ona dosłownie na zanurzeniu się w atmosferze lasu tak, jak w wodzie. To sposób na relaks, redukcję stresu, poprawę nastroju, aktywny odpoczynek, medytację oraz terapię, który równolegle wpływa na zdrowie psychiczne i fizyczne
zHttpClient client = new HttpClient(handler);
client.BaseAddress = new Uri("[https://test-e-dokumenty.mf.gov.pl](https://test-e-dokumenty.mf.gov.pl)");
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/xml"));
var stringContent = new StringContent(doc.ToString(), Encoding.UTF8, "application/xml");
var response = client.PostAsync("/api/Storage/InitUploadSigned?enableValidateQualifiedSignature=true", stringContent);
X509Certificate2 certyfikat = new X509Certificate2(@"C:\sendjpk\alice.pfx", "lol");
string signedFilePath = @"C:\sendjpk\initupload-envelopedSigned.xades.xml";
SignXmlFileNew2(initFileXml, signedFilePath, certyfikat);
//send xml
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
WebRequestHandler handler = new WebRequestHandler();
string wynik = String.Empty;
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
WebRequestHandler wrh = new WebRequestHandler();
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/xml";
try
{
wynik = wc.UploadString("[https://test-e-dokumenty.mf.gov.pl/api/Storage/InitUploadSigned",](https://test-e-dokumenty.mf.gov.pl/api/Storage/InitUploadSigned",) File.ReadAllText(signedFilePath));
}
catch(WebException ex)
{
using (var reader =
string filepath = JpkStoreDirPath + file.NazwaPliku;
// generate one-time encryption key
AesCryptoServiceProvider aesEncryption = new AesCryptoServiceProvider();
aesEncryption.KeySize = 256;
aesEncryption.BlockSize = 128;
aesEncryption.Mode = CipherMode.CBC;
aesEncryption.Padding = PaddingMode.PKCS7;
aesEncryption.GenerateIV();
string ivStr = Convert.ToBase64String(aesEncryption.IV);
aesEncryption.GenerateKey();
//get sha256
byte[] hashValue;
string hash256;
using (FileStream fileStream = File.Open(filePath, FileMode.Open))
{
Wykop.pl
i z góry dziękuje
#ksw