etcimon / botan

Block & stream ciphers, public key crypto, hashing, KDF, MAC, PKCS, TLS, ASN.1, BER/DER, etc.
Other
85 stars 22 forks source link

Cannot use botan.cert.x509.x509self #63

Open Dadoum opened 1 year ago

Dadoum commented 1 year ago

Hey, thanks for your work!

However, I can't get botan.cert.x509.x509self to work. When imported, the D compiler is complaining:

../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/crl_ent.d(27,18): Error: template instance `RefCounted!CRLEntryImpl` template `RefCounted` is not defined
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/allocators.d(138,29): Error: class `X509CRLImpl` is forward referenced
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/allocators.d(139,20): Error: class `X509CRLImpl` is forward referenced
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/utils.d(38,18): Error: template instance `memutils.allocators.AllocSize!(X509CRLImpl)` error instantiating
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/refcounted.d(31,20):        instantiated from here: `ObjectAllocator!(X509CRLImpl, ThreadMem)`
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/refcounted.d(199,29):        instantiated from here: `opCall!()`
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/x509_crl.d(30,17):        instantiated from here: `RefCounted!(X509CRLImpl, ThreadMem)`
../../.dub/packages/memutils-1.0.9/memutils/source/memutils/refcounted.d(15,2): Error: mixin `memutils.refcounted.RefCounted!(X509CRLImpl, ThreadMem).RefCounted.Embed!(m_object, false)` error instantiating
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/certstor.d(85,28): Error: function `botan.cert.x509.certstor.CertificateStoreInMemory.allSubjects` does not override any function
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/certstor.d(95,30): Error: function `botan.cert.x509.certstor.CertificateStoreInMemory.findCertRef` does not override any function
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/certstor.d(159,28): Error: function `botan.cert.x509.certstor.CertificateStoreOverlay.allSubjects` does not override any function
../../.dub/packages/botan-1.13.4/botan/source/botan/cert/x509/certstor.d(167,30): Error: function `botan.cert.x509.certstor.CertificateStoreOverlay.findCertRef` does not override any function
etcimon commented 1 year ago

Have you tried latest version of LDC? Which compiler did you use?

Dadoum commented 1 year ago

I tried with DMD v2.102.1 and ldc2-f397130d ("LDC 1.32.0-git-f397130 based on DMD v2.102.2 and LLVM 15.0.7"). GDC doesn't work either but that's related to SIMD.

etcimon commented 1 year ago

Have you tried building the selfsigned example? It seems to work on my end, what does your code look like?

Dadoum commented 1 year ago

The self-signed example works.

This code doesn't:

#!/usr/bin/env dub
/+ dub.sdl:
        name "botan_test"
        dependency "botan" version="~>1.13.4"
+/

    import botan.cert.x509.x509self;
    import botan.pubkey.algo.rsa;
    import botan.pubkey.pkcs8: BER_encode;
    import botan.rng.rng;

void main() {
        import std.stdio : writeln;
        writeln("Hello, World!");
}
Dadoum commented 1 year ago

Okay, adding the other imports in the example made it work, thanks. I keep the issue open if you want to add a static assert with a better error message, otherwise you can close it.

etcimon commented 1 year ago

I was thinking it might be a compiler bug related to the imports, I'll try and isolate it later.