├── .gitattributes ├── .gitignore ├── .gitmodules ├── CHANGELOG ├── CMakeLists.txt ├── Curve25519.pm ├── Makefile ├── README.md ├── bin ├── cliraop-freebsd-x86_64 ├── cliraop-linux-aarch64 ├── cliraop-linux-arm ├── cliraop-linux-armv5 ├── cliraop-linux-armv6 ├── cliraop-linux-mips ├── cliraop-linux-mipsel ├── cliraop-linux-powerpc ├── cliraop-linux-sparc64 ├── cliraop-linux-x86 ├── cliraop-linux-x86_64 ├── cliraop-macos-arm64 ├── cliraop-macos-x86_64 ├── cliraop-macos.lipo ├── cliraop-solaris-x86_64 ├── cliraop.exe ├── libcrypto-1_1.dll └── libssl-1_1.dll ├── build.cmd ├── build.sh ├── cliraop.vcxproj ├── cliraop.vcxproj.filters ├── doc ├── Binary plist structure.docx └── auth_protocol.html ├── libraop.sln ├── libraop.vcxproj ├── pairing ├── lib │ ├── 5.14 │ │ ├── MSWin32-x86-multi-thread │ │ │ └── auto │ │ │ │ ├── Crypt │ │ │ │ └── Ed25519 │ │ │ │ │ ├── Ed25519.bs │ │ │ │ │ └── Ed25519.dll │ │ │ │ └── CryptX │ │ │ │ ├── CryptX.bs │ │ │ │ └── CryptX.dll │ │ └── arm-linux-gnueabihf-thread-multi-64int │ │ │ └── auto │ │ │ ├── Crypt │ │ │ └── Ed25519 │ │ │ │ ├── Ed25519.bs │ │ │ │ └── Ed25519.so │ │ │ └── CryptX │ │ │ ├── CryptX.bs │ │ │ └── CryptX.so │ ├── 5.18 │ │ └── darwin-thread-multi-2level │ │ │ └── auto │ │ │ ├── Crypt │ │ │ └── Ed25519 │ │ │ │ └── Ed25519.bundle │ │ │ └── CryptX │ │ │ └── CryptX.bundle │ ├── 5.20 │ │ ├── arm-linux-gnueabihf-thread-multi-64int │ │ │ └── auto │ │ │ │ ├── Crypt │ │ │ │ └── Ed25519 │ │ │ │ │ └── Ed25519.so │ │ │ │ └── CryptX │ │ │ │ └── CryptX.so │ │ ├── i386-linux-thread-multi │ │ │ └── auto │ │ │ │ ├── Crypt │ │ │ │ └── Ed25519 │ │ │ │ │ └── Ed25519.so │ │ │ │ └── CryptX │ │ │ │ └── CryptX.so │ │ └── x86_64-linux-gnu-thread-multi │ │ │ └── auto │ │ │ ├── Crypt │ │ │ └── Ed25519 │ │ │ │ └── Ed25519.so │ │ │ └── CryptX │ │ │ └── CryptX.so │ ├── 5.24 │ │ ├── arm-linux-gnueabihf-thread-multi-64int │ │ │ └── auto │ │ │ │ ├── Crypt │ │ │ │ └── Ed25519 │ │ │ │ │ └── Ed25519.so │ │ │ │ └── CryptX │ │ │ │ └── CryptX.so │ │ ├── i386-linux-thread-multi │ │ │ └── auto │ │ │ │ ├── Crypt │ │ │ │ └── Ed25519 │ │ │ │ │ └── Ed25519.so │ │ │ │ └── CryptX │ │ │ │ └── CryptX.so │ │ └── x86_64-linux-gnu-thread-multi │ │ │ └── auto │ │ │ ├── Crypt │ │ │ └── Ed25519 │ │ │ │ └── Ed25519.so │ │ │ └── CryptX │ │ │ └── CryptX.so │ ├── Crypt │ │ ├── AuthEnc.pm │ │ ├── AuthEnc │ │ │ ├── CCM.pm │ │ │ ├── ChaCha20Poly1305.pm │ │ │ ├── EAX.pm │ │ │ ├── GCM.pm │ │ │ └── OCB.pm │ │ ├── Checksum.pm │ │ ├── Checksum │ │ │ ├── Adler32.pm │ │ │ └── CRC32.pm │ │ ├── Cipher.pm │ │ ├── Cipher │ │ │ ├── AES.pm │ │ │ ├── Anubis.pm │ │ │ ├── Blowfish.pm │ │ │ ├── CAST5.pm │ │ │ ├── Camellia.pm │ │ │ ├── DES.pm │ │ │ ├── DES_EDE.pm │ │ │ ├── KASUMI.pm │ │ │ ├── Khazad.pm │ │ │ ├── MULTI2.pm │ │ │ ├── Noekeon.pm │ │ │ ├── RC2.pm │ │ │ ├── RC5.pm │ │ │ ├── RC6.pm │ │ │ ├── SAFERP.pm │ │ │ ├── SAFER_K128.pm │ │ │ ├── SAFER_K64.pm │ │ │ ├── SAFER_SK128.pm │ │ │ ├── SAFER_SK64.pm │ │ │ ├── SEED.pm │ │ │ ├── Skipjack.pm │ │ │ ├── Twofish.pm │ │ │ └── XTEA.pm │ │ ├── Digest.pm │ │ ├── Digest │ │ │ ├── BLAKE2b_160.pm │ │ │ ├── BLAKE2b_256.pm │ │ │ ├── BLAKE2b_384.pm │ │ │ ├── BLAKE2b_512.pm │ │ │ ├── BLAKE2s_128.pm │ │ │ ├── BLAKE2s_160.pm │ │ │ ├── BLAKE2s_224.pm │ │ │ ├── BLAKE2s_256.pm │ │ │ ├── CHAES.pm │ │ │ ├── MD2.pm │ │ │ ├── MD4.pm │ │ │ ├── MD5.pm │ │ │ ├── RIPEMD128.pm │ │ │ ├── RIPEMD160.pm │ │ │ ├── RIPEMD256.pm │ │ │ ├── RIPEMD320.pm │ │ │ ├── SHA1.pm │ │ │ ├── SHA224.pm │ │ │ ├── SHA256.pm │ │ │ ├── SHA384.pm │ │ │ ├── SHA3_224.pm │ │ │ ├── SHA3_256.pm │ │ │ ├── SHA3_384.pm │ │ │ ├── SHA3_512.pm │ │ │ ├── SHA512.pm │ │ │ ├── SHA512_224.pm │ │ │ ├── SHA512_256.pm │ │ │ ├── SHAKE.pm │ │ │ ├── Tiger192.pm │ │ │ └── Whirlpool.pm │ │ ├── Ed25519.pm │ │ ├── KeyDerivation.pm │ │ ├── Mac.pm │ │ ├── Mac │ │ │ ├── BLAKE2b.pm │ │ │ ├── BLAKE2s.pm │ │ │ ├── F9.pm │ │ │ ├── HMAC.pm │ │ │ ├── OMAC.pm │ │ │ ├── PMAC.pm │ │ │ ├── Pelican.pm │ │ │ ├── Poly1305.pm │ │ │ └── XCBC.pm │ │ ├── Misc.pm │ │ ├── Mode.pm │ │ ├── Mode │ │ │ ├── CBC.pm │ │ │ ├── CFB.pm │ │ │ ├── CTR.pm │ │ │ ├── ECB.pm │ │ │ └── OFB.pm │ │ ├── PK.pm │ │ ├── PK │ │ │ ├── DH.pm │ │ │ ├── DSA.pm │ │ │ ├── ECC.pm │ │ │ └── RSA.pm │ │ ├── PRNG.pm │ │ ├── PRNG │ │ │ ├── ChaCha20.pm │ │ │ ├── Fortuna.pm │ │ │ ├── RC4.pm │ │ │ ├── Sober128.pm │ │ │ └── Yarrow.pm │ │ ├── SRP.pm │ │ └── Stream │ │ │ ├── ChaCha.pm │ │ │ ├── RC4.pm │ │ │ └── Sober128.pm │ ├── CryptX.pm │ ├── Data │ │ ├── Plist.pm │ │ └── Plist │ │ │ ├── BinaryReader.pm │ │ │ ├── BinaryWriter.pm │ │ │ ├── Foundation │ │ │ ├── LibraryToDo.pm │ │ │ ├── NSArray.pm │ │ │ ├── NSData.pm │ │ │ ├── NSMutableArray.pm │ │ │ ├── NSMutableData.pm │ │ │ ├── NSMutableString.pm │ │ │ ├── NSObject.pm │ │ │ ├── NSString.pm │ │ │ ├── NSURL.pm │ │ │ ├── ToDo.pm │ │ │ ├── ToDoAlarm.pm │ │ │ └── ToDoAlarms.pm │ │ │ ├── Reader.pm │ │ │ ├── Writer.pm │ │ │ └── XMLWriter.pm │ ├── Math │ │ └── BigInt │ │ │ └── LTM.pm │ └── UNIVERSAL │ │ └── require.pm └── pairing.pl ├── src ├── aes.c ├── aes.h ├── aes_ctr.c ├── aes_ctr.h ├── alac.c ├── alac.h ├── bplist.cpp ├── bplist.h ├── cliraop.c ├── pairing.cpp ├── password.c ├── raop_client.c ├── raop_client.h ├── raop_server.c ├── raop_server.h ├── raop_streamer.c ├── raop_streamer.h ├── rtsp_client.c └── rtsp_client.h └── targets ├── freebsd └── x86_64 │ └── libraop.a ├── include ├── raop_client.h ├── raop_server.h └── raop_streamer.h ├── linux ├── aarch64 │ └── libraop.a ├── arm │ └── libraop.a ├── armv5 │ └── libraop.a ├── armv6 │ └── libraop.a ├── mips │ └── libraop.a ├── mipsel │ └── libraop.a ├── powerpc │ └── libraop.a ├── sparc64 │ └── libraop.a ├── x86 │ └── libraop.a └── x86_64 │ └── libraop.a ├── macos ├── arm64 │ └── libraop.a └── x86_64 │ └── libraop.a ├── solaris └── x86_64 │ └── libraop.a └── win32 └── x86 ├── libraop.lib ├── libraop.pdb ├── libraop_d.lib └── libraop_d.pdb /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | 49 | # C++ builder related 50 | __history 51 | /Win32 52 | *.i?? 53 | *.map 54 | *.tds 55 | *.local 56 | *.res 57 | 58 | # Misc 59 | *.o 60 | *.obj 61 | *.save* 62 | *.pcm 63 | 64 | # CMake build folder 65 | /build/ 66 | .vs/ 67 | *.bak 68 | *.user 69 | lib/ 70 | *.pdb 71 | *.bat 72 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "curve25519"] 2 | path = curve25519 3 | url = https://github.com/philippe44/curve25519 4 | [submodule "libopenssl"] 5 | path = libopenssl 6 | url = https://github.com/Philippe44/libopenssl 7 | [submodule "libcodecs"] 8 | path = libcodecs 9 | url = https://github.com/Philippe44/libcodecs 10 | [submodule "libmdns"] 11 | path = libmdns 12 | url = https://github.com/philippe44/libmdns 13 | [submodule "dmap-parser"] 14 | path = dmap-parser 15 | url = https://github.com/philippe44/dmap-parser 16 | [submodule "crosstools"] 17 | path = crosstools 18 | url = https://github.com/philippe44/crosstools 19 | [submodule "libpthreads4w"] 20 | path = libpthreads4w 21 | url = https://github.com/philippe44/libpthreads4w 22 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | 2023-12 2 | - raop_streamer: no content-length on chunked-encoding, even on range request -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.5) 2 | 3 | if(WIN32) 4 | set(HOST Win32) 5 | set(PLATFORM x86) 6 | set(LIB lib) 7 | set(PROJECT "raop_play") 8 | else() 9 | if(NOT HOST OR NOT PLATFORM) 10 | if(CMAKE_C_COMPILER) 11 | set(C_COMPILER ${CMAKE_C_COMPILER}) 12 | message(STATUS "using CMAKE_C_COMPILER ${CMAKE_C_COMPILER}") 13 | else() 14 | execute_process(COMMAND bash "-c" "readlink -f `which cc`" OUTPUT_VARIABLE C_COMPILER) 15 | cmake_path(GET C_COMPILER FILENAME C_COMPILER) 16 | message(STATUS "guessing compiler ${C_COMPILER}") 17 | endif() 18 | 19 | string(REGEX MATCHALL "([^-]+)" CC_SPLIT ${C_COMPILER}) 20 | 21 | list(GET CC_SPLIT 0 PLATFORM) 22 | list(LENGTH CC_SPLIT C_TUPLE_SIZE) 23 | 24 | if(C_TUPLE_SIZE EQUAL 5) 25 | list(GET CC_SPLIT 1 HOST) 26 | else() 27 | list(GET CC_SPLIT 2 HOST) 28 | endif() 29 | endif() 30 | 31 | set(LIB a) 32 | set(PROJECT "raop_play-${HOST}-${PLATFORM}") 33 | endif() 34 | 35 | if(NOT HOST OR NOT PLATFORM) 36 | message(STATUS "cannot define HOST (${HOST}) and/or PLATFORM ${PLATFORM}") 37 | return() 38 | endif() 39 | 40 | set(BASE ${CMAKE_CURRENT_SOURCE_DIR}) 41 | project(${PROJECT}) 42 | 43 | message(STATUS "Base directory is ${BASE}") 44 | message(STATUS "Using CC ${CMAKE_C_COMPILER} and ${CMAKE_CXX_COMPILER}") 45 | message(STATUS "Building for ${HOST}-${PLATFORM} with cmake's definition ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") 46 | 47 | # Configurable options 48 | set(CMAKE_CXX_STANDARD 17) 49 | 50 | if(MSVC) 51 | add_compile_definitions(NOMINMAX _WINSOCK_DEPRECATED_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE) 52 | add_definitions(/wd4068 /wd4244 /wd4018 /wd4101 /wd4102 /wd4142 /wd4996 /wd4090) 53 | else() 54 | add_compile_options(-O2 -fdata-sections -ffunction-sections) 55 | # who knows why it must be there and not in add_compile_options... well, that's CMake 56 | # oh, and setting "POSITION_INDEPENDENT_CODE" property does not wrok, of course 57 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-pie") 58 | endif() 59 | 60 | # Main target sources 61 | file(GLOB SOURCES src/*.cpp src/*.c ${BASE}/crosstools/src/*.c) 62 | list(APPEND SOURCES ${BASE}/dmap-parser/dmap_parser.c) 63 | list(APPEND EXTRA_INCLUDES src) 64 | add_executable(${PROJECT} ${SOURCES}) 65 | 66 | # Other includes 67 | list(APPEND EXTRA_INCLUDES ${BASE}/crosstools/src ${BASE}/dmap-parser) 68 | 69 | # openSSL manually 70 | target_include_directories(${PROJECT} PRIVATE ${BASE}/libopenssl/targets/${HOST}/${PLATFORM}/include) 71 | target_link_libraries(${PROJECT} PRIVATE ${BASE}/libopenssl/targets/${HOST}/${PLATFORM}/libopenssl.${LIB}) 72 | 73 | # codecs with cmake 74 | find_package(libcodecs REQUIRED CONFIG PATHS ${BASE}/libcodecs) 75 | get_target_property(_INFO libcodecs::codecs INTERFACE_INCLUDE_DIRECTORIES) 76 | target_include_directories(${PROJECT} PRIVATE "${_INFO}") 77 | get_target_property(_INFO libcodecs::codecs IMPORTED_LOCATION_RELEASE) 78 | target_link_libraries(${PROJECT} PRIVATE ${_INFO}) 79 | 80 | # mDNS manually 81 | target_include_directories(${PROJECT} PRIVATE ${BASE}/libmdns/targets/include/mdnssvc) 82 | target_include_directories(${PROJECT} PRIVATE ${BASE}/libmdns/targets/include/mdnssd) 83 | target_link_libraries(${PROJECT} PRIVATE ${BASE}/libmdns/targets/${HOST}/${PLATFORM}/libmdns.${LIB}) 84 | 85 | # pthreads manually 86 | if(MSVC) 87 | target_include_directories(${PROJECT} PRIVATE ${BASE}/common/libpthreads4w/targets/${HOST}/${PLATFORM}/include) 88 | target_link_libraries(${PROJECT} PRIVATE ${BASE}/common/libpthreads4w/targets/${HOST}/${PLATFORM}/libpthreadVC3.lib) 89 | endif() 90 | 91 | # Configure the target 92 | if(NOT MSVC) 93 | target_link_libraries(${PROJECT} PUBLIC stdc++ m pthread dl) 94 | if(NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS") 95 | #target_link_options(${PROJECT} PUBLIC -static) 96 | endif() 97 | if(CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64) 98 | set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lmvec") 99 | endif() 100 | if(CMAKE_SYSTEM_NAME STREQUAL SunOS) 101 | set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lssp") 102 | endif() 103 | endif() 104 | 105 | target_compile_definitions(${PROJECT} PRIVATE -DNDEBUG -D_GNU_SOURCE) 106 | target_include_directories(${PROJECT} PRIVATE "." ${EXTRA_INCLUDES}) -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(CC),cc) 2 | CC=$(lastword $(subst /, ,$(shell readlink -f `which cc`))) 3 | endif 4 | 5 | ifeq ($(findstring gcc,$(CC)),gcc) 6 | CFLAGS += -Wno-stringop-truncation -Wno-stringop-overflow -Wno-format-truncation -Wno-multichar 7 | LDFLAGS += -s -lstdc++ 8 | else 9 | CFLAGS += -fno-temp-file 10 | LDFLAGS += -lc++ 11 | endif 12 | 13 | PLATFORM ?= $(firstword $(subst -, ,$(CC))) 14 | HOST ?= $(word 2, $(subst -, ,$(CC))) 15 | 16 | SRC = src 17 | CORE = bin/cliraop-$(HOST) 18 | BUILDDIR = $(dir $(CORE))$(HOST)/$(PLATFORM) 19 | LIB = lib/$(HOST)/$(PLATFORM)/libraop.a 20 | EXECUTABLE = $(CORE)-$(PLATFORM) 21 | 22 | DEFINES = -DNDEBUG -D_GNU_SOURCE 23 | CFLAGS += -Wall -fPIC -ggdb -O2 $(DEFINES) -fdata-sections -ffunction-sections 24 | LDFLAGS += -lpthread -ldl -lm -L. 25 | 26 | TOOLS = crosstools/src 27 | #VALGRIND = ../valgrind 28 | DMAP_PARSER = dmap-parser 29 | MDNS = libmdns/targets 30 | CODECS = libcodecs/targets 31 | OPENSSL = libopenssl/targets/$(HOST)/$(PLATFORM) 32 | 33 | vpath %.c $(TOOLS):$(SRC):$(DMAP_PARSER) 34 | vpath %.cpp $(TOOLS):$(SRC) 35 | 36 | INCLUDE = -I$(VALGRIND)/memcheck -I$(VALGRIND)/include \ 37 | -I$(TOOLS) \ 38 | -I$(DMAP_PARSER) \ 39 | -I$(MDNS)/include/mdnssvc -I$(MDNS)/include/mdnssd \ 40 | -I$(OPENSSL)/include \ 41 | -I$(CODECS)/include/addons -I$(CODECS)/include/flac \ 42 | -I$(CODECS)/include/shine -I$(CODECS)/include/faac \ 43 | -I$(SRC) -I$(SRC)/inc 44 | 45 | CURVE25519_SOURCES = curve25519_dh.c curve25519_mehdi.c curve25519_order.c curve25519_utils.c custom_blind.c\ 46 | ed25519_sign.c ed25519_verify.c \ 47 | 48 | SOURCES = raop_client.c rtsp_client.c \ 49 | raop_server.c raop_streamer.c \ 50 | aes.c aes_ctr.c \ 51 | dmap_parser.c \ 52 | alac.c \ 53 | bplist.cpp pairing.cpp password.c 54 | 55 | SOURCES_BIN = cross_log.c cross_ssl.c cross_util.c cross_net.c platform.c cliraop.c 56 | 57 | OBJECTS = $(patsubst %.c,$(BUILDDIR)/%.o,$(filter %.c,$(SOURCES))) 58 | OBJECTS += $(patsubst %.cpp,$(BUILDDIR)/%.o,$(filter %.cpp,$(SOURCES))) 59 | 60 | LIBRARY = $(CODECS)/$(HOST)/$(PLATFORM)/libcodecs.a $(MDNS)/$(HOST)/$(PLATFORM)/libmdns.a 61 | 62 | ifneq ($(STATIC),) 63 | LIBRARY += $(OPENSSL)/libopenssl.a 64 | DEFINES += -DSSL_STATIC_LIB 65 | endif 66 | 67 | all: lib $(EXECUTABLE) 68 | lib: directory $(LIB) 69 | directory: 70 | @mkdir -p lib/$(HOST)/$(PLATFORM) 71 | @mkdir -p $(BUILDDIR) 72 | 73 | $(EXECUTABLE): $(SOURCES_BIN:%.c=$(BUILDDIR)/%.o) $(LIB) 74 | $(CC) $^ $(LIBRARY) $(CFLAGS) $(LDFLAGS) -o $@ 75 | ifeq ($(HOST),macos) 76 | rm -f $(CORE) 77 | lipo -create -output $(CORE) $$(ls $(CORE)* | grep -v '\-static') 78 | endif 79 | 80 | $(LIB): $(OBJECTS) 81 | $(AR) rcs $@ $^ 82 | 83 | $(BUILDDIR)/%.o : %.c 84 | $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDE) $< -c -o $@ 85 | 86 | $(BUILDDIR)/%.o : %.cpp 87 | $(CXX) $(CXXFLAGS) $(CFLAGS) $(CPPFLAGS) $(INCLUDE) $< -c -o $@ 88 | 89 | cleanlib: 90 | rm -f $(BUILDDIR)/*.o $(LIB) 91 | 92 | clean: cleanlib 93 | rm -f $(EXECUTABLE) $(CORE) 94 | 95 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## RAOP player and library (AirPlay) 2 | 3 | This is a RAOP (airplay) player and library for the v2 protocol (with synchro). It works for Windows, OSX, Linux x86 and ARM. 4 | There is a small player can can play raw pcm form any file or stdin (useful for use pipes with a decoder like lame, flac or ffmpeg) 5 | 6 | The player is just and example how to use the library, but it has a few interesting options: 7 | 8 | ```text 9 | usage: ./build/raop_play 10 | [-ntp ] write current NTP in and exit 11 | [-p ] 12 | [-v (0-100)] 13 | [-l (frames] 14 | [-w ] (start after milliseconds) 15 | [-n ] (start at NTP + ) 16 | [-nf ] (start at NTP in + ) 17 | [-e] (encrypt) 18 | [-s ] (valid secret for AppleTV) 19 | [-r] (do interactive pairing with AppleTV) 20 | [-d ] (0 = silent) 21 | [-i] (interactive commands: 'p'=pause, 'r'=(re)start, 's'=stop, 'q'=exit, ' '=block) 22 | ``` 23 | 24 | It's possible to send synchronous audio to multiple players by using the NTP options (optionally combined with the wait option). 25 | Either get the NTP of the master machine from any application and then fork multiple instances of raop_play with that NTP and 26 | the same audio file, or use the -ntp option to get NTP to be written to a file and re-use that file when calling the instances of 27 | raop_play 28 | 29 | ## Building using CMake 30 | 31 | ```sh 32 | # install build libreries 33 | apt-get install build-essential cmake libssl-dev 34 | 35 | # Fetch all dependencies 36 | # git submodule update --init 37 | git submodule update --force --recursive --init --remote 38 | 39 | # Create build directory 40 | mkdir build 41 | cd build 42 | 43 | # Build project 44 | cmake .. 45 | make 46 | ``` 47 | Note that this is a cross-compiler CMake file so it's better to run it and define HOST and PLATFORM options (see the build.sh) but it's not mandatory. 48 | To better understand how my cross-compilation works, see [here](https://github.com/philippe44/cross-compiling) 49 | ## Building using Make 50 | 51 | Makefiles are provided for OSX, Linux (x86 and ARM). Under Windows, there is a VS2022 project. You'll need some libraires: 52 | 53 | - ALAC codec: https://github.com/macosforge/alac and 54 | - Curve25519 crypto: https://github.com/msotoodeh/curve25519 55 | 56 | You need pthread for Windows to recompile the player / use the library here: https://www.sourceware.org/pthreads-win32 57 | 58 | ## Misc 59 | It's largely inspired from https://github.com/chevil/raop2_play but limit the playback to pcm as it focuses on creating a library and optimizing AirPlay synchronization 60 | 61 | Since iOS 10.2, pairing is required with AppleTV. Here is a description of the protocol https://htmlpreview.github.io/?https://github.com/philippe44/RAOP-Player/blob/master/doc/auth_protocol.html 62 | -------------------------------------------------------------------------------- /bin/cliraop-freebsd-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-freebsd-x86_64 -------------------------------------------------------------------------------- /bin/cliraop-linux-aarch64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-aarch64 -------------------------------------------------------------------------------- /bin/cliraop-linux-arm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-arm -------------------------------------------------------------------------------- /bin/cliraop-linux-armv5: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-armv5 -------------------------------------------------------------------------------- /bin/cliraop-linux-armv6: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-armv6 -------------------------------------------------------------------------------- /bin/cliraop-linux-mips: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-mips -------------------------------------------------------------------------------- /bin/cliraop-linux-mipsel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-mipsel -------------------------------------------------------------------------------- /bin/cliraop-linux-powerpc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-powerpc -------------------------------------------------------------------------------- /bin/cliraop-linux-sparc64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-sparc64 -------------------------------------------------------------------------------- /bin/cliraop-linux-x86: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-x86 -------------------------------------------------------------------------------- /bin/cliraop-linux-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-linux-x86_64 -------------------------------------------------------------------------------- /bin/cliraop-macos-arm64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-macos-arm64 -------------------------------------------------------------------------------- /bin/cliraop-macos-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-macos-x86_64 -------------------------------------------------------------------------------- /bin/cliraop-macos.lipo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-macos.lipo -------------------------------------------------------------------------------- /bin/cliraop-solaris-x86_64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop-solaris-x86_64 -------------------------------------------------------------------------------- /bin/cliraop.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/cliraop.exe -------------------------------------------------------------------------------- /bin/libcrypto-1_1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/libcrypto-1_1.dll -------------------------------------------------------------------------------- /bin/libssl-1_1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/bin/libssl-1_1.dll -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- 1 | setlocal 2 | 3 | call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat" 4 | 5 | if /I [%1] == [rebuild] ( 6 | set option="-t:Rebuild" 7 | ) 8 | 9 | msbuild libraop.sln /p:Configuration=Release /p:Platform=x86 %option% 10 | msbuild libraop.sln /p:Configuration=Debug /p:Platform=x86 %option% 11 | 12 | set target=targets\win32\x86 13 | 14 | if exist %target% ( 15 | del %target%\*.lib 16 | ) 17 | 18 | robocopy lib\win32\x86 %target% lib*.lib lib*.pdb /NDL /NJH /NJS /nc /ns /np 19 | robocopy src targets\include raop_client.h /NDL /NJH /NJS /nc /ns /np 20 | robocopy src targets\include raop_server.h /NDL /NJH /NJS /nc /ns /np 21 | robocopy src targets\include raop_streamer.h /NDL /NJH /NJS /nc /ns /np 22 | 23 | endlocal 24 | 25 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | list="x86_64-linux-gnu-gcc x86-linux-gnu-gcc arm-linux-gnueabi-gcc aarch64-linux-gnu-gcc \ 4 | sparc64-linux-gnu-gcc mips-linux-gnu-gcc mipsel-linux-gnu-gcc powerpc-linux-gnu-gcc x86_64-macos-darwin-gcc \ 5 | arm64-macos-darwin-cc x86_64-freebsd-gnu-gcc x86_64-solaris-gnu-gcc armv6-linux-gnueabi-gcc \ 6 | armv5-linux-gnueabi-gcc" 7 | 8 | declare -A alias=( [x86-linux-gnu-gcc]=i686-stretch-linux-gnu-gcc \ 9 | [x86_64-linux-gnu-gcc]=x86_64-stretch-linux-gnu-gcc \ 10 | [arm-linux-gnueabi-gcc]=armv7-stretch-linux-gnueabi-gcc \ 11 | [armv5-linux-gnueabi-gcc]=armv6-stretch-linux-gnueabi-gcc \ 12 | [armv6-linux-gnueabi-gcc]=armv6-stretch-linux-gnueabi-gcc \ 13 | [aarch64-linux-gnu-gcc]=aarch64-stretch-linux-gnu-gcc \ 14 | [sparc64-linux-gnu-gcc]=sparc64-stretch-linux-gnu-gcc \ 15 | [mips-linux-gnu-gcc]=mips64-stretch-linux-gnu-gcc \ 16 | [mipsel-linux-gnu-gcc]=mips64el-stretch-linux-gnu-gcc \ 17 | [powerpc-linux-gnu-gcc]=powerpc64-stretch-linux-gnu-gcc \ 18 | [x86_64-macos-darwin-gcc]=x86_64-apple-darwin19-gcc \ 19 | [arm64-macos-darwin-cc]=arm64-apple-darwin20.4-cc \ 20 | [x86_64-freebsd-gnu-gcc]=x86_64-cross-freebsd12.3-gcc \ 21 | [x86_64-solaris-gnu-gcc]=x86_64-cross-solaris2.x-gcc ) 22 | 23 | declare -A cflags=( [sparc64-linux-gnu-gcc]="-mcpu=v7" \ 24 | [mips-linux-gnu-gcc]="-march=mips32" \ 25 | [mipsel-linux-gnu-gcc]="-march=mips32" \ 26 | [x86_64-linux-gnu-gcc]="-fno-fast-math" \ 27 | [armv5-linux-gnueabi-gcc]="-march=armv5t -mfloat-abi=soft" \ 28 | [powerpc-linux-gnu-gcc]="-m32" ) 29 | 30 | declare -a compilers 31 | 32 | IFS= read -ra candidates <<< "$list" 33 | 34 | # do we have "clean" somewhere in parameters (assuming no compiler has "clean" in it... 35 | if [[ $@[*]} =~ clean ]]; then 36 | clean="clean" 37 | fi 38 | 39 | # first select platforms/compilers 40 | for cc in ${candidates[@]}; do 41 | # check compiler first 42 | if ! command -v ${alias[$cc]:-$cc} &> /dev/null; then 43 | if command -v $cc &> /dev/null; then 44 | unset alias[$cc] 45 | else 46 | continue 47 | fi 48 | fi 49 | 50 | if [[ $# == 0 || ($# == 1 && -n $clean) ]]; then 51 | compilers+=($cc) 52 | continue 53 | fi 54 | 55 | for arg in $@ 56 | do 57 | if [[ $cc =~ $arg ]]; then 58 | compilers+=($cc) 59 | fi 60 | done 61 | done 62 | 63 | # do we want library only (can be used to rebuild as a submodule and not mess us bin/ directory) 64 | if [[ $@[*]} =~ --libonly ]]; then 65 | if [[ -n $clean ]]; then 66 | action="cleanlib" 67 | else 68 | action="lib" 69 | fi 70 | else 71 | action=$clean 72 | fi 73 | 74 | item=raop 75 | 76 | # then iterate selected platforms/compilers 77 | for cc in ${compilers[@]} 78 | do 79 | IFS=- read -r platform host dummy <<< $cc 80 | 81 | export CFLAGS="${cflags[$cc]}" 82 | export CC=${alias[$cc]:-$cc} 83 | 84 | # don't let clang create temp files 85 | if [[ $CC =~ -gcc ]]; then 86 | export CXX=${CC%-*}-g++ 87 | else 88 | export CXX=${CC%-*}-c++ 89 | CFLAGS+=" -fno-temp-file -stdlib=libc++" 90 | fi 91 | 92 | target=targets/$host/$platform 93 | mkdir -p targets/include 94 | mkdir -p $target 95 | pwd=$(pwd) 96 | 97 | make AR=${CC%-*}-ar CC=$CC STATIC=1 PLATFORM=$platform HOST=$host $action -j8 98 | 99 | if [[ -z $clean ]]; then 100 | cp lib/$host/$platform/lib$item.a $target 101 | cp -u src/raop_client.h targets/include 102 | cp -u src/raop_server.h targets/include 103 | cp -u src/raop_streamer.h targets/include 104 | else 105 | rm -f $target/lib$item.a 106 | fi 107 | done 108 | -------------------------------------------------------------------------------- /cliraop.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | crosstools 7 | 8 | 9 | crosstools 10 | 11 | 12 | crosstools 13 | 14 | 15 | crosstools 16 | 17 | 18 | crosstools 19 | 20 | 21 | crosstools 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | {f63c4eff-35cb-48b9-92a1-2f72d1af8c17} 33 | 34 | 35 | -------------------------------------------------------------------------------- /doc/Binary plist structure.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/doc/Binary plist structure.docx -------------------------------------------------------------------------------- /libraop.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32901.215 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cliraop", "cliraop.vcxproj", "{AFB3D404-7084-434B-A25E-9C5BDC3FA40A}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {31FA7682-7D64-4B3F-99DD-5A3423D18DCA} = {31FA7682-7D64-4B3F-99DD-5A3423D18DCA} 9 | EndProjectSection 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libraop", "libraop.vcxproj", "{31FA7682-7D64-4B3F-99DD-5A3423D18DCA}" 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|x86 = Debug|x86 16 | Release|x86 = Release|x86 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {AFB3D404-7084-434B-A25E-9C5BDC3FA40A}.Debug|x86.ActiveCfg = Debug|Win32 20 | {AFB3D404-7084-434B-A25E-9C5BDC3FA40A}.Debug|x86.Build.0 = Debug|Win32 21 | {AFB3D404-7084-434B-A25E-9C5BDC3FA40A}.Release|x86.ActiveCfg = Release|Win32 22 | {AFB3D404-7084-434B-A25E-9C5BDC3FA40A}.Release|x86.Build.0 = Release|Win32 23 | {31FA7682-7D64-4B3F-99DD-5A3423D18DCA}.Debug|x86.ActiveCfg = Debug|Win32 24 | {31FA7682-7D64-4B3F-99DD-5A3423D18DCA}.Debug|x86.Build.0 = Debug|Win32 25 | {31FA7682-7D64-4B3F-99DD-5A3423D18DCA}.Release|x86.ActiveCfg = Release|Win32 26 | {31FA7682-7D64-4B3F-99DD-5A3423D18DCA}.Release|x86.Build.0 = Release|Win32 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | GlobalSection(ExtensibilityGlobals) = postSolution 32 | SolutionGuid = {4F7D16B4-16B7-40E4-8EC0-B8D23FC1FE54} 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /pairing/lib/5.14/MSWin32-x86-multi-thread/auto/Crypt/Ed25519/Ed25519.bs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.14/MSWin32-x86-multi-thread/auto/Crypt/Ed25519/Ed25519.bs -------------------------------------------------------------------------------- /pairing/lib/5.14/MSWin32-x86-multi-thread/auto/Crypt/Ed25519/Ed25519.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.14/MSWin32-x86-multi-thread/auto/Crypt/Ed25519/Ed25519.dll -------------------------------------------------------------------------------- /pairing/lib/5.14/MSWin32-x86-multi-thread/auto/CryptX/CryptX.bs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.14/MSWin32-x86-multi-thread/auto/CryptX/CryptX.bs -------------------------------------------------------------------------------- /pairing/lib/5.14/MSWin32-x86-multi-thread/auto/CryptX/CryptX.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.14/MSWin32-x86-multi-thread/auto/CryptX/CryptX.dll -------------------------------------------------------------------------------- /pairing/lib/5.14/arm-linux-gnueabihf-thread-multi-64int/auto/Crypt/Ed25519/Ed25519.bs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.14/arm-linux-gnueabihf-thread-multi-64int/auto/Crypt/Ed25519/Ed25519.bs -------------------------------------------------------------------------------- /pairing/lib/5.14/arm-linux-gnueabihf-thread-multi-64int/auto/Crypt/Ed25519/Ed25519.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.14/arm-linux-gnueabihf-thread-multi-64int/auto/Crypt/Ed25519/Ed25519.so -------------------------------------------------------------------------------- /pairing/lib/5.14/arm-linux-gnueabihf-thread-multi-64int/auto/CryptX/CryptX.bs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.14/arm-linux-gnueabihf-thread-multi-64int/auto/CryptX/CryptX.bs -------------------------------------------------------------------------------- /pairing/lib/5.14/arm-linux-gnueabihf-thread-multi-64int/auto/CryptX/CryptX.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.14/arm-linux-gnueabihf-thread-multi-64int/auto/CryptX/CryptX.so -------------------------------------------------------------------------------- /pairing/lib/5.18/darwin-thread-multi-2level/auto/Crypt/Ed25519/Ed25519.bundle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.18/darwin-thread-multi-2level/auto/Crypt/Ed25519/Ed25519.bundle -------------------------------------------------------------------------------- /pairing/lib/5.18/darwin-thread-multi-2level/auto/CryptX/CryptX.bundle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.18/darwin-thread-multi-2level/auto/CryptX/CryptX.bundle -------------------------------------------------------------------------------- /pairing/lib/5.20/arm-linux-gnueabihf-thread-multi-64int/auto/Crypt/Ed25519/Ed25519.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.20/arm-linux-gnueabihf-thread-multi-64int/auto/Crypt/Ed25519/Ed25519.so -------------------------------------------------------------------------------- /pairing/lib/5.20/arm-linux-gnueabihf-thread-multi-64int/auto/CryptX/CryptX.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.20/arm-linux-gnueabihf-thread-multi-64int/auto/CryptX/CryptX.so -------------------------------------------------------------------------------- /pairing/lib/5.20/i386-linux-thread-multi/auto/Crypt/Ed25519/Ed25519.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.20/i386-linux-thread-multi/auto/Crypt/Ed25519/Ed25519.so -------------------------------------------------------------------------------- /pairing/lib/5.20/i386-linux-thread-multi/auto/CryptX/CryptX.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.20/i386-linux-thread-multi/auto/CryptX/CryptX.so -------------------------------------------------------------------------------- /pairing/lib/5.20/x86_64-linux-gnu-thread-multi/auto/Crypt/Ed25519/Ed25519.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.20/x86_64-linux-gnu-thread-multi/auto/Crypt/Ed25519/Ed25519.so -------------------------------------------------------------------------------- /pairing/lib/5.20/x86_64-linux-gnu-thread-multi/auto/CryptX/CryptX.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.20/x86_64-linux-gnu-thread-multi/auto/CryptX/CryptX.so -------------------------------------------------------------------------------- /pairing/lib/5.24/arm-linux-gnueabihf-thread-multi-64int/auto/Crypt/Ed25519/Ed25519.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.24/arm-linux-gnueabihf-thread-multi-64int/auto/Crypt/Ed25519/Ed25519.so -------------------------------------------------------------------------------- /pairing/lib/5.24/arm-linux-gnueabihf-thread-multi-64int/auto/CryptX/CryptX.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.24/arm-linux-gnueabihf-thread-multi-64int/auto/CryptX/CryptX.so -------------------------------------------------------------------------------- /pairing/lib/5.24/i386-linux-thread-multi/auto/Crypt/Ed25519/Ed25519.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.24/i386-linux-thread-multi/auto/Crypt/Ed25519/Ed25519.so -------------------------------------------------------------------------------- /pairing/lib/5.24/i386-linux-thread-multi/auto/CryptX/CryptX.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.24/i386-linux-thread-multi/auto/CryptX/CryptX.so -------------------------------------------------------------------------------- /pairing/lib/5.24/x86_64-linux-gnu-thread-multi/auto/Crypt/Ed25519/Ed25519.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.24/x86_64-linux-gnu-thread-multi/auto/Crypt/Ed25519/Ed25519.so -------------------------------------------------------------------------------- /pairing/lib/5.24/x86_64-linux-gnu-thread-multi/auto/CryptX/CryptX.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/pairing/lib/5.24/x86_64-linux-gnu-thread-multi/auto/CryptX/CryptX.so -------------------------------------------------------------------------------- /pairing/lib/Crypt/AuthEnc.pm: -------------------------------------------------------------------------------- 1 | package Crypt::AuthEnc; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | sub CLONE_SKIP { 1 } # prevent cloning 8 | 9 | 1; 10 | 11 | __END__ 12 | 13 | =head1 NAME 14 | 15 | Crypt::AuthEnc - [internal only] 16 | 17 | =cut -------------------------------------------------------------------------------- /pairing/lib/Crypt/AuthEnc/CCM.pm: -------------------------------------------------------------------------------- 1 | package Crypt::AuthEnc::CCM; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use base qw(Crypt::AuthEnc Exporter); 8 | our %EXPORT_TAGS = ( all => [qw( ccm_encrypt_authenticate ccm_decrypt_verify )] ); 9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 10 | our @EXPORT = qw(); 11 | 12 | use CryptX; 13 | use Crypt::Cipher; 14 | 15 | ### the following functions are implemented in XS: 16 | # - _memory_encrypt 17 | # - _memory_decrypt 18 | 19 | sub ccm_encrypt_authenticate { 20 | my $cipher_name = shift; 21 | my $key = shift; 22 | my $nonce = shift; 23 | my $adata = shift; 24 | my $tag_len = shift; 25 | my $plaintext = shift; 26 | return _memory_encrypt(Crypt::Cipher::_trans_cipher_name($cipher_name), $key, $nonce, $adata, $tag_len, $plaintext); 27 | } 28 | 29 | sub ccm_decrypt_verify { 30 | my $cipher_name = shift; 31 | my $key = shift; 32 | my $nonce = shift; 33 | my $adata = shift; 34 | my $ciphertext = shift; 35 | my $tag = shift; 36 | return _memory_decrypt(Crypt::Cipher::_trans_cipher_name($cipher_name), $key, $nonce, $adata, $ciphertext, $tag); 37 | } 38 | 39 | 1; 40 | 41 | =pod 42 | 43 | =head1 NAME 44 | 45 | Crypt::AuthEnc::CCM - Authenticated encryption in CCM mode 46 | 47 | =head1 SYNOPSIS 48 | 49 | ### functional interface 50 | use Crypt::AuthEnc::CCM qw(ccm_encrypt_authenticate ccm_decrypt_verify); 51 | 52 | my ($ciphertext, $tag) = ccm_encrypt_authenticate('AES', $key, $nonce, $adata, $tag_len, $plaintext); 53 | my $plaintext = ccm_decrypt_verify('AES', $key, $nonce, $adata, $ciphertext, $tag); 54 | 55 | =head1 DESCRIPTION 56 | 57 | CCM is a encrypt+authenticate mode that is centered around using AES (or any 16-byte cipher) as aprimitive. 58 | Unlike EAX and OCB mode, it is only meant for packet mode where the length of the input is known in advance. 59 | 60 | =head1 EXPORT 61 | 62 | Nothing is exported by default. 63 | 64 | You can export selected functions: 65 | 66 | use Crypt::AuthEnc::CCM qw(ccm_encrypt_authenticate ccm_decrypt_verify); 67 | 68 | =head1 FUNCTIONS 69 | 70 | =head2 ccm_encrypt_authenticate 71 | 72 | my ($ciphertext, $tag) = ccm_encrypt_authenticate($cipher, $key, $nonce, $adata, $tag_len, $plaintext); 73 | 74 | # $cipher .. 'AES' or name of any other cipher with 16-byte block len 75 | # $key ..... key of proper length (e.g. 128/192/256bits for AES) 76 | # $nonce ... unique nonce/salt (no need to keep it secret) 77 | # $adata ... additional authenticated data 78 | # $tag_len . required length of output tag 79 | 80 | CCM parameters should follow L 81 | 82 | # tag length: 4, 6, 8, 10, 12, 14, 16 (reasonable minimum is 8) 83 | # nonce length: 7, 8, 9, 10, 11, 12, 13 (if you are not sure, use 11) 84 | # BEWARE nonce length determines max. enc/dec data size: max_data_size = 2^(8*(15-nonce_len)) 85 | 86 | =head2 ccm_decrypt_verify 87 | 88 | my $plaintext = ccm_decrypt_verify($cipher, $key, $nonce, $adata, $ciphertext, $tag); 89 | 90 | # on error returns undef 91 | 92 | =head1 SEE ALSO 93 | 94 | =over 95 | 96 | =item * L, L, L, L 97 | 98 | =item * L 99 | 100 | =back 101 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/Checksum/Adler32.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Checksum::Adler32; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | use Carp; 7 | use CryptX; 8 | 9 | sub addfile { 10 | my ($self, $file) = @_; 11 | 12 | my $handle; 13 | if (ref(\$file) eq 'SCALAR') { #filename 14 | open($handle, "<", $file) || croak "FATAL: cannot open '$file': $!"; 15 | binmode($handle); 16 | } 17 | else { #handle 18 | $handle = $file 19 | } 20 | croak "FATAL: invalid handle" unless defined $handle; 21 | 22 | my $n; 23 | my $buf = ""; 24 | while (($n = read($handle, $buf, 32*1024))) { 25 | $self->add($buf) 26 | } 27 | croak "FATAL: read failed: $!" unless defined $n; 28 | 29 | return $self; 30 | } 31 | 32 | sub CLONE_SKIP { 1 } # prevent cloning 33 | 34 | 1; 35 | 36 | =pod 37 | 38 | =head1 NAME 39 | 40 | Crypt::Checksum::Adler32 - Compute Adler32 checksum 41 | 42 | =head1 SYNOPSIS 43 | 44 | use Crypt::Checksum::Adler32; 45 | 46 | $d = Crypt::Checksum::Adler32->new; 47 | $d->add('any data'); 48 | $d->addfile('filename.dat'); 49 | $d->addfile(*FILEHANDLE); 50 | $checksum_raw = $d->digest; # raw bytes 51 | $checksum_hex = $d->hexdigest; # hexadecimal form 52 | 53 | =head1 DESCRIPTION 54 | 55 | Calculating Adler32 checksums (OO interface); 56 | 57 | I 58 | 59 | =head1 METHODS 60 | 61 | =head2 new 62 | 63 | Constructor, returns a reference to the checksum object. 64 | 65 | $d = Crypt::Checksum::Adler32->new; 66 | 67 | =head2 clone 68 | 69 | Creates a copy of the checksum object state and returns a reference to the copy. 70 | 71 | $d->clone(); 72 | 73 | =head2 reset 74 | 75 | Reinitialize the checksum object state and returns a reference to the checksum object. 76 | 77 | $d->reset(); 78 | 79 | =head2 add 80 | 81 | All arguments are appended to the message we calculate checksum for. 82 | The return value is the checksum object itself. 83 | 84 | $d->add('any data'); 85 | #or 86 | $d->add('any data', 'more data', 'even more data'); 87 | 88 | =head2 addfile 89 | 90 | The content of the file (or filehandle) is appended to the message we calculate checksum for. 91 | The return value is the checksum object itself. 92 | 93 | $d->addfile('filename.dat'); 94 | #or 95 | $d->addfile(*FILEHANDLE); 96 | 97 | B You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. 98 | 99 | =head2 digest 100 | 101 | Returns the binary checksum (raw bytes). 102 | 103 | $result_raw = $d->digest(); 104 | 105 | =head2 hexdigest 106 | 107 | Returns the checksum encoded as a hexadecimal string. 108 | 109 | $result_hex = $d->hexdigest(); 110 | 111 | =head1 SEE ALSO 112 | 113 | =over 114 | 115 | =item * L, L 116 | 117 | =item * L 118 | 119 | =back 120 | 121 | =cut -------------------------------------------------------------------------------- /pairing/lib/Crypt/Checksum/CRC32.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Checksum::CRC32; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | use Carp; 7 | use CryptX; 8 | 9 | sub addfile { 10 | my ($self, $file) = @_; 11 | 12 | my $handle; 13 | if (ref(\$file) eq 'SCALAR') { #filename 14 | open($handle, "<", $file) || croak "FATAL: cannot open '$file': $!"; 15 | binmode($handle); 16 | } 17 | else { #handle 18 | $handle = $file 19 | } 20 | croak "FATAL: invalid handle" unless defined $handle; 21 | 22 | my $n; 23 | my $buf = ""; 24 | while (($n = read($handle, $buf, 32*1024))) { 25 | $self->add($buf) 26 | } 27 | croak "FATAL: read failed: $!" unless defined $n; 28 | 29 | return $self; 30 | } 31 | 32 | sub CLONE_SKIP { 1 } # prevent cloning 33 | 34 | 1; 35 | 36 | =pod 37 | 38 | =head1 NAME 39 | 40 | Crypt::Checksum::CRC32 - Compute CRC32 checksum 41 | 42 | =head1 SYNOPSIS 43 | 44 | use Crypt::Checksum::CRC32; 45 | 46 | $d = Crypt::Checksum::CRC32->new; 47 | $d->add('any data'); 48 | $d->addfile('filename.dat'); 49 | $d->addfile(*FILEHANDLE); 50 | $checksum_raw = $d->digest; # raw bytes 51 | $checksum_hex = $d->hexdigest; # hexadecimal form 52 | 53 | =head1 DESCRIPTION 54 | 55 | Calculating CRC32 checksums (OO interface); 56 | 57 | I 58 | 59 | =head1 METHODS 60 | 61 | =head2 new 62 | 63 | Constructor, returns a reference to the checksum object. 64 | 65 | $d = Crypt::Checksum::CRC32->new; 66 | 67 | =head2 clone 68 | 69 | Creates a copy of the checksum object state and returns a reference to the copy. 70 | 71 | $d->clone(); 72 | 73 | =head2 reset 74 | 75 | Reinitialize the checksum object state and returns a reference to the checksum object. 76 | 77 | $d->reset(); 78 | 79 | =head2 add 80 | 81 | All arguments are appended to the message we calculate checksum for. 82 | The return value is the checksum object itself. 83 | 84 | $d->add('any data'); 85 | #or 86 | $d->add('any data', 'more data', 'even more data'); 87 | 88 | =head2 addfile 89 | 90 | The content of the file (or filehandle) is appended to the message we calculate checksum for. 91 | The return value is the checksum object itself. 92 | 93 | $d->addfile('filename.dat'); 94 | #or 95 | $d->addfile(*FILEHANDLE); 96 | 97 | B You have to make sure that the filehandle is in binary mode before you pass it as argument to the addfile() method. 98 | 99 | =head2 digest 100 | 101 | Returns the binary checksum (raw bytes). 102 | 103 | $result_raw = $d->digest(); 104 | 105 | =head2 hexdigest 106 | 107 | Returns the checksum encoded as a hexadecimal string. 108 | 109 | $result_hex = $d->hexdigest(); 110 | 111 | =head1 SEE ALSO 112 | 113 | =over 114 | 115 | =item * L, L 116 | 117 | =item * L 118 | 119 | =back 120 | 121 | =cut -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/AES.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::AES; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::AES - Symetric cipher AES (aka Rijndael), key size: 128/192/256 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('AES'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::AES; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::AES', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the AES cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::AES->new($key); 58 | #or 59 | $c = Crypt::Cipher::AES->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::AES->keysize; 74 | #or 75 | Crypt::Cipher::AES::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::AES->blocksize; 82 | #or 83 | Crypt::Cipher::AES::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::AES->max_keysize; 90 | #or 91 | Crypt::Cipher::AES::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::AES->min_keysize; 98 | #or 99 | Crypt::Cipher::AES::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::AES->default_rounds; 106 | #or 107 | Crypt::Cipher::AES::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/Anubis.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::Anubis; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::Anubis - Symetric cipher Anubis, key size: 128-320 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('Anubis'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::Anubis; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Anubis', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the Anubis cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::Anubis->new($key); 58 | #or 59 | $c = Crypt::Cipher::Anubis->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::Anubis->keysize; 74 | #or 75 | Crypt::Cipher::Anubis::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::Anubis->blocksize; 82 | #or 83 | Crypt::Cipher::Anubis::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::Anubis->max_keysize; 90 | #or 91 | Crypt::Cipher::Anubis::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::Anubis->min_keysize; 98 | #or 99 | Crypt::Cipher::Anubis::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::Anubis->default_rounds; 106 | #or 107 | Crypt::Cipher::Anubis::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/Blowfish.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::Blowfish; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::Blowfish - Symetric cipher Blowfish, key size: 64-448 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('Blowfish'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::Blowfish; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Blowfish', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the Blowfish cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::Blowfish->new($key); 58 | #or 59 | $c = Crypt::Cipher::Blowfish->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::Blowfish->keysize; 74 | #or 75 | Crypt::Cipher::Blowfish::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::Blowfish->blocksize; 82 | #or 83 | Crypt::Cipher::Blowfish::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::Blowfish->max_keysize; 90 | #or 91 | Crypt::Cipher::Blowfish::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::Blowfish->min_keysize; 98 | #or 99 | Crypt::Cipher::Blowfish::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::Blowfish->default_rounds; 106 | #or 107 | Crypt::Cipher::Blowfish::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/CAST5.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::CAST5; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::CAST5 - Symetric cipher CAST5 (aka CAST-128), key size: 40-128 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('CAST5'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::CAST5; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::CAST5', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the CAST5 cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::CAST5->new($key); 58 | #or 59 | $c = Crypt::Cipher::CAST5->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::CAST5->keysize; 74 | #or 75 | Crypt::Cipher::CAST5::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::CAST5->blocksize; 82 | #or 83 | Crypt::Cipher::CAST5::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::CAST5->max_keysize; 90 | #or 91 | Crypt::Cipher::CAST5::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::CAST5->min_keysize; 98 | #or 99 | Crypt::Cipher::CAST5::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::CAST5->default_rounds; 106 | #or 107 | Crypt::Cipher::CAST5::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/Camellia.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::Camellia; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::Camellia - Symetric cipher Camellia, key size: 128/192/256 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('Camellia'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::Camellia; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Camellia', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the Camellia cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::Camellia->new($key); 58 | #or 59 | $c = Crypt::Cipher::Camellia->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::Camellia->keysize; 74 | #or 75 | Crypt::Cipher::Camellia::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::Camellia->blocksize; 82 | #or 83 | Crypt::Cipher::Camellia::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::Camellia->max_keysize; 90 | #or 91 | Crypt::Cipher::Camellia::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::Camellia->min_keysize; 98 | #or 99 | Crypt::Cipher::Camellia::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::Camellia->default_rounds; 106 | #or 107 | Crypt::Cipher::Camellia::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/DES.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::DES; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::DES - Symetric cipher DES, key size: 64[56] bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('DES'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::DES; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::DES', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the DES cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::DES->new($key); 58 | #or 59 | $c = Crypt::Cipher::DES->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::DES->keysize; 74 | #or 75 | Crypt::Cipher::DES::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::DES->blocksize; 82 | #or 83 | Crypt::Cipher::DES::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::DES->max_keysize; 90 | #or 91 | Crypt::Cipher::DES::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::DES->min_keysize; 98 | #or 99 | Crypt::Cipher::DES::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::DES->default_rounds; 106 | #or 107 | Crypt::Cipher::DES::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/DES_EDE.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::DES_EDE; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::DES_EDE - Symetric cipher DES_EDE (aka Tripple-DES, 3DES), key size: 192[168] bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('DES_EDE'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::DES_EDE; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::DES_EDE', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the DES_EDE cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::DES_EDE->new($key); 58 | #or 59 | $c = Crypt::Cipher::DES_EDE->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::DES_EDE->keysize; 74 | #or 75 | Crypt::Cipher::DES_EDE::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::DES_EDE->blocksize; 82 | #or 83 | Crypt::Cipher::DES_EDE::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::DES_EDE->max_keysize; 90 | #or 91 | Crypt::Cipher::DES_EDE::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::DES_EDE->min_keysize; 98 | #or 99 | Crypt::Cipher::DES_EDE::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::DES_EDE->default_rounds; 106 | #or 107 | Crypt::Cipher::DES_EDE::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/KASUMI.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::KASUMI; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::KASUMI - Symetric cipher KASUMI, key size: 128 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('KASUMI'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::KASUMI; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::KASUMI', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the KASUMI cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::KASUMI->new($key); 58 | #or 59 | $c = Crypt::Cipher::KASUMI->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::KASUMI->keysize; 74 | #or 75 | Crypt::Cipher::KASUMI::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::KASUMI->blocksize; 82 | #or 83 | Crypt::Cipher::KASUMI::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::KASUMI->max_keysize; 90 | #or 91 | Crypt::Cipher::KASUMI::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::KASUMI->min_keysize; 98 | #or 99 | Crypt::Cipher::KASUMI::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::KASUMI->default_rounds; 106 | #or 107 | Crypt::Cipher::KASUMI::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/Khazad.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::Khazad; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::Khazad - Symetric cipher Khazad, key size: 128 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('Khazad'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::Khazad; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Khazad', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the Khazad cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::Khazad->new($key); 58 | #or 59 | $c = Crypt::Cipher::Khazad->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::Khazad->keysize; 74 | #or 75 | Crypt::Cipher::Khazad::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::Khazad->blocksize; 82 | #or 83 | Crypt::Cipher::Khazad::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::Khazad->max_keysize; 90 | #or 91 | Crypt::Cipher::Khazad::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::Khazad->min_keysize; 98 | #or 99 | Crypt::Cipher::Khazad::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::Khazad->default_rounds; 106 | #or 107 | Crypt::Cipher::Khazad::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/MULTI2.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::MULTI2; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::MULTI2 - Symetric cipher MULTI2, key size: 320 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('MULTI2'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::MULTI2; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::MULTI2', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the MULTI2 cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::MULTI2->new($key); 58 | #or 59 | $c = Crypt::Cipher::MULTI2->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::MULTI2->keysize; 74 | #or 75 | Crypt::Cipher::MULTI2::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::MULTI2->blocksize; 82 | #or 83 | Crypt::Cipher::MULTI2::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::MULTI2->max_keysize; 90 | #or 91 | Crypt::Cipher::MULTI2::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::MULTI2->min_keysize; 98 | #or 99 | Crypt::Cipher::MULTI2::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::MULTI2->default_rounds; 106 | #or 107 | Crypt::Cipher::MULTI2::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/Noekeon.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::Noekeon; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::Noekeon - Symetric cipher Noekeon, key size: 128 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('Noekeon'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::Noekeon; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Noekeon', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the Noekeon cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::Noekeon->new($key); 58 | #or 59 | $c = Crypt::Cipher::Noekeon->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::Noekeon->keysize; 74 | #or 75 | Crypt::Cipher::Noekeon::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::Noekeon->blocksize; 82 | #or 83 | Crypt::Cipher::Noekeon::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::Noekeon->max_keysize; 90 | #or 91 | Crypt::Cipher::Noekeon::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::Noekeon->min_keysize; 98 | #or 99 | Crypt::Cipher::Noekeon::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::Noekeon->default_rounds; 106 | #or 107 | Crypt::Cipher::Noekeon::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/RC2.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::RC2; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::RC2 - Symetric cipher RC2, key size: 64-1024 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('RC2'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::RC2; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC2', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the RC2 cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::RC2->new($key); 58 | #or 59 | $c = Crypt::Cipher::RC2->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::RC2->keysize; 74 | #or 75 | Crypt::Cipher::RC2::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::RC2->blocksize; 82 | #or 83 | Crypt::Cipher::RC2::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::RC2->max_keysize; 90 | #or 91 | Crypt::Cipher::RC2::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::RC2->min_keysize; 98 | #or 99 | Crypt::Cipher::RC2::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::RC2->default_rounds; 106 | #or 107 | Crypt::Cipher::RC2::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/RC5.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::RC5; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::RC5 - Symetric cipher RC5, key size: 64-1024 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('RC5'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::RC5; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC5', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the RC5 cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::RC5->new($key); 58 | #or 59 | $c = Crypt::Cipher::RC5->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::RC5->keysize; 74 | #or 75 | Crypt::Cipher::RC5::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::RC5->blocksize; 82 | #or 83 | Crypt::Cipher::RC5::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::RC5->max_keysize; 90 | #or 91 | Crypt::Cipher::RC5::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::RC5->min_keysize; 98 | #or 99 | Crypt::Cipher::RC5::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::RC5->default_rounds; 106 | #or 107 | Crypt::Cipher::RC5::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/RC6.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::RC6; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::RC6 - Symetric cipher RC6, key size: 64-1024 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('RC6'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::RC6; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::RC6', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the RC6 cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::RC6->new($key); 58 | #or 59 | $c = Crypt::Cipher::RC6->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::RC6->keysize; 74 | #or 75 | Crypt::Cipher::RC6::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::RC6->blocksize; 82 | #or 83 | Crypt::Cipher::RC6::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::RC6->max_keysize; 90 | #or 91 | Crypt::Cipher::RC6::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::RC6->min_keysize; 98 | #or 99 | Crypt::Cipher::RC6::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::RC6->default_rounds; 106 | #or 107 | Crypt::Cipher::RC6::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/SAFERP.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::SAFERP; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::SAFERP - Symetric cipher SAFER+, key size: 128/192/256 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('SAFERP'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::SAFERP; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFERP', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the SAFERP cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::SAFERP->new($key); 58 | #or 59 | $c = Crypt::Cipher::SAFERP->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::SAFERP->keysize; 74 | #or 75 | Crypt::Cipher::SAFERP::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::SAFERP->blocksize; 82 | #or 83 | Crypt::Cipher::SAFERP::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::SAFERP->max_keysize; 90 | #or 91 | Crypt::Cipher::SAFERP::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::SAFERP->min_keysize; 98 | #or 99 | Crypt::Cipher::SAFERP::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::SAFERP->default_rounds; 106 | #or 107 | Crypt::Cipher::SAFERP::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/SAFER_K128.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::SAFER_K128; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::SAFER_K128 - Symetric cipher SAFER_K128, key size: 128 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('SAFER_K128'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::SAFER_K128; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_K128', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the SAFER_K128 cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::SAFER_K128->new($key); 58 | #or 59 | $c = Crypt::Cipher::SAFER_K128->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::SAFER_K128->keysize; 74 | #or 75 | Crypt::Cipher::SAFER_K128::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::SAFER_K128->blocksize; 82 | #or 83 | Crypt::Cipher::SAFER_K128::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::SAFER_K128->max_keysize; 90 | #or 91 | Crypt::Cipher::SAFER_K128::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::SAFER_K128->min_keysize; 98 | #or 99 | Crypt::Cipher::SAFER_K128::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::SAFER_K128->default_rounds; 106 | #or 107 | Crypt::Cipher::SAFER_K128::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/SAFER_K64.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::SAFER_K64; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::SAFER_K64 - Symetric cipher SAFER_K64, key size: 64 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('SAFER_K64'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::SAFER_K64; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_K64', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the SAFER_K64 cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::SAFER_K64->new($key); 58 | #or 59 | $c = Crypt::Cipher::SAFER_K64->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::SAFER_K64->keysize; 74 | #or 75 | Crypt::Cipher::SAFER_K64::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::SAFER_K64->blocksize; 82 | #or 83 | Crypt::Cipher::SAFER_K64::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::SAFER_K64->max_keysize; 90 | #or 91 | Crypt::Cipher::SAFER_K64::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::SAFER_K64->min_keysize; 98 | #or 99 | Crypt::Cipher::SAFER_K64::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::SAFER_K64->default_rounds; 106 | #or 107 | Crypt::Cipher::SAFER_K64::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/SAFER_SK128.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::SAFER_SK128; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::SAFER_SK128 - Symetric cipher SAFER_SK128, key size: 128 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('SAFER_SK128'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::SAFER_SK128; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_SK128', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the SAFER_SK128 cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::SAFER_SK128->new($key); 58 | #or 59 | $c = Crypt::Cipher::SAFER_SK128->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::SAFER_SK128->keysize; 74 | #or 75 | Crypt::Cipher::SAFER_SK128::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::SAFER_SK128->blocksize; 82 | #or 83 | Crypt::Cipher::SAFER_SK128::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::SAFER_SK128->max_keysize; 90 | #or 91 | Crypt::Cipher::SAFER_SK128::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::SAFER_SK128->min_keysize; 98 | #or 99 | Crypt::Cipher::SAFER_SK128::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::SAFER_SK128->default_rounds; 106 | #or 107 | Crypt::Cipher::SAFER_SK128::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/SAFER_SK64.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::SAFER_SK64; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::SAFER_SK64 - Symetric cipher SAFER_SK64, key size: 64 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('SAFER_SK64'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::SAFER_SK64; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SAFER_SK64', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the SAFER_SK64 cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::SAFER_SK64->new($key); 58 | #or 59 | $c = Crypt::Cipher::SAFER_SK64->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::SAFER_SK64->keysize; 74 | #or 75 | Crypt::Cipher::SAFER_SK64::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::SAFER_SK64->blocksize; 82 | #or 83 | Crypt::Cipher::SAFER_SK64::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::SAFER_SK64->max_keysize; 90 | #or 91 | Crypt::Cipher::SAFER_SK64::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::SAFER_SK64->min_keysize; 98 | #or 99 | Crypt::Cipher::SAFER_SK64::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::SAFER_SK64->default_rounds; 106 | #or 107 | Crypt::Cipher::SAFER_SK64::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/SEED.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::SEED; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::SEED - Symetric cipher SEED, key size: 128 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('SEED'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::SEED; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::SEED', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the SEED cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::SEED->new($key); 58 | #or 59 | $c = Crypt::Cipher::SEED->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::SEED->keysize; 74 | #or 75 | Crypt::Cipher::SEED::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::SEED->blocksize; 82 | #or 83 | Crypt::Cipher::SEED::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::SEED->max_keysize; 90 | #or 91 | Crypt::Cipher::SEED::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::SEED->min_keysize; 98 | #or 99 | Crypt::Cipher::SEED::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::SEED->default_rounds; 106 | #or 107 | Crypt::Cipher::SEED::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/Skipjack.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::Skipjack; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::Skipjack - Symetric cipher Skipjack, key size: 80 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('Skipjack'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::Skipjack; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Skipjack', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the Skipjack cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::Skipjack->new($key); 58 | #or 59 | $c = Crypt::Cipher::Skipjack->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::Skipjack->keysize; 74 | #or 75 | Crypt::Cipher::Skipjack::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::Skipjack->blocksize; 82 | #or 83 | Crypt::Cipher::Skipjack::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::Skipjack->max_keysize; 90 | #or 91 | Crypt::Cipher::Skipjack::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::Skipjack->min_keysize; 98 | #or 99 | Crypt::Cipher::Skipjack::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::Skipjack->default_rounds; 106 | #or 107 | Crypt::Cipher::Skipjack::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/Twofish.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::Twofish; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::Twofish - Symetric cipher Twofish, key size: 128/192/256 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('Twofish'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::Twofish; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::Twofish', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the Twofish cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::Twofish->new($key); 58 | #or 59 | $c = Crypt::Cipher::Twofish->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::Twofish->keysize; 74 | #or 75 | Crypt::Cipher::Twofish::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::Twofish->blocksize; 82 | #or 83 | Crypt::Cipher::Twofish::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::Twofish->max_keysize; 90 | #or 91 | Crypt::Cipher::Twofish::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::Twofish->min_keysize; 98 | #or 99 | Crypt::Cipher::Twofish::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::Twofish->default_rounds; 106 | #or 107 | Crypt::Cipher::Twofish::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Cipher/XTEA.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Cipher::XTEA; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use CryptX; 10 | use base 'Crypt::Cipher'; 11 | 12 | sub blocksize { Crypt::Cipher::blocksize(__PACKAGE__) } 13 | sub keysize { Crypt::Cipher::keysize(__PACKAGE__) } 14 | sub max_keysize { Crypt::Cipher::max_keysize(__PACKAGE__) } 15 | sub min_keysize { Crypt::Cipher::min_keysize(__PACKAGE__) } 16 | sub default_rounds { Crypt::Cipher::default_rounds(__PACKAGE__) } 17 | 18 | 1; 19 | 20 | =pod 21 | 22 | =head1 NAME 23 | 24 | Crypt::Cipher::XTEA - Symetric cipher XTEA, key size: 128 bits (Crypt::CBC compliant) 25 | 26 | =head1 SYNOPSIS 27 | 28 | ### example 1 29 | use Crypt::Mode::CBC; 30 | 31 | my $key = '...'; # length has to be valid key size for this cipher 32 | my $iv = '...'; # 16 bytes 33 | my $cbc = Crypt::Mode::CBC->new('XTEA'); 34 | my $ciphertext = $cbc->encrypt("secret data", $key, $iv); 35 | 36 | ### example 2 37 | use Crypt::CBC; 38 | use Crypt::Cipher::XTEA; 39 | 40 | my $key = '...'; # length has to be valid key size for this cipher 41 | my $iv = '...'; # 16 bytes 42 | my $cbc = Crypt::CBC->new( -cipher=>'Cipher::XTEA', -key=>$key, -iv=>$iv ); 43 | my $ciphertext = $cbc->encrypt("secret data"); 44 | 45 | =head1 DESCRIPTION 46 | 47 | This module implements the XTEA cipher. Provided interface is compliant with L module. 48 | 49 | B This module implements just elementary "one-block-(en|de)cryption" operation - if you want to 50 | encrypt/decrypt generic data you have to use some of the cipher block modes - check for example 51 | L, L or L (which will be slower). 52 | 53 | =head1 METHODS 54 | 55 | =head2 new 56 | 57 | $c = Crypt::Cipher::XTEA->new($key); 58 | #or 59 | $c = Crypt::Cipher::XTEA->new($key, $rounds); 60 | 61 | =head2 encrypt 62 | 63 | $ciphertext = $c->encrypt($plaintext); 64 | 65 | =head2 decrypt 66 | 67 | $plaintext = $c->decrypt($ciphertext); 68 | 69 | =head2 keysize 70 | 71 | $c->keysize; 72 | #or 73 | Crypt::Cipher::XTEA->keysize; 74 | #or 75 | Crypt::Cipher::XTEA::keysize; 76 | 77 | =head2 blocksize 78 | 79 | $c->blocksize; 80 | #or 81 | Crypt::Cipher::XTEA->blocksize; 82 | #or 83 | Crypt::Cipher::XTEA::blocksize; 84 | 85 | =head2 max_keysize 86 | 87 | $c->max_keysize; 88 | #or 89 | Crypt::Cipher::XTEA->max_keysize; 90 | #or 91 | Crypt::Cipher::XTEA::max_keysize; 92 | 93 | =head2 min_keysize 94 | 95 | $c->min_keysize; 96 | #or 97 | Crypt::Cipher::XTEA->min_keysize; 98 | #or 99 | Crypt::Cipher::XTEA::min_keysize; 100 | 101 | =head2 default_rounds 102 | 103 | $c->default_rounds; 104 | #or 105 | Crypt::Cipher::XTEA->default_rounds; 106 | #or 107 | Crypt::Cipher::XTEA::default_rounds; 108 | 109 | =head1 SEE ALSO 110 | 111 | =over 112 | 113 | =item * L, L 114 | 115 | =item * L 116 | 117 | =back 118 | 119 | =cut 120 | 121 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Digest/SHAKE.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Digest::SHAKE; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use Carp; 8 | $Carp::Internal{(__PACKAGE__)}++; 9 | use CryptX; 10 | 11 | sub new { my $class = shift; _new(@_) } 12 | 13 | sub addfile { 14 | my ($self, $file) = @_; 15 | 16 | my $handle; 17 | if (ref(\$file) eq 'SCALAR') { #filename 18 | open($handle, "<", $file) || croak "FATAL: cannot open '$file': $!"; 19 | binmode($handle); 20 | } 21 | else { #handle 22 | $handle = $file 23 | } 24 | croak "FATAL: invalid handle" unless defined $handle; 25 | 26 | my $n; 27 | my $buf = ""; 28 | while (($n = read($handle, $buf, 32*1024))) { 29 | $self->add($buf) 30 | } 31 | croak "FATAL: read failed: $!" unless defined $n; 32 | 33 | return $self; 34 | } 35 | 36 | sub CLONE_SKIP { 1 } # prevent cloning 37 | 38 | 1; 39 | 40 | =pod 41 | 42 | =head1 NAME 43 | 44 | Crypt::Digest::SHAKE - Hash functions SHAKE128, SHAKE256 from SHA3 family 45 | 46 | =head1 SYNOPSIS 47 | 48 | use Crypt::Digest::SHAKE 49 | 50 | $d = Crypt::Digest::SHAKE->new(128); 51 | $d->add('any data'); 52 | $d->addfile('filename.dat'); 53 | $d->addfile(*FILEHANDLE); 54 | $part1 = $d->done(100); # 100 raw bytes 55 | $part2 = $d->done(100); # another 100 raw bytes 56 | #... 57 | 58 | =head1 DESCRIPTION 59 | 60 | Provides an interface to the SHA3's sponge function SHAKE. 61 | 62 | =head1 METHODS 63 | 64 | =head2 new 65 | 66 | $d = Crypt::Digest::SHA3-SHAKE->new($num); 67 | # $num ... 128 or 256 68 | 69 | =head2 clone 70 | 71 | $d->clone(); 72 | 73 | =head2 reset 74 | 75 | $d->reset(); 76 | 77 | =head2 add 78 | 79 | $d->add('any data'); 80 | #or 81 | $d->add('any data', 'more data', 'even more data'); 82 | 83 | =head2 addfile 84 | 85 | $d->addfile('filename.dat'); 86 | #or 87 | $d->addfile(*FILEHANDLE); 88 | 89 | =head2 done 90 | 91 | $result_raw = $d->done($len); 92 | # can be called multiple times 93 | 94 | =head1 SEE ALSO 95 | 96 | =over 97 | 98 | =item * L, L 99 | 100 | =item * L 101 | 102 | =back 103 | 104 | =cut 105 | 106 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mac.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mac; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | require Exporter; our @ISA = qw(Exporter); ### use Exporter 'import'; 8 | our %EXPORT_TAGS = ( all => [qw( mac mac_hex )] ); 9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 10 | our @EXPORT = qw(); 11 | 12 | sub add { 13 | my $self = shift; 14 | $self->_add_single($_) for (@_); 15 | return $self; 16 | } 17 | 18 | sub addfile { 19 | my ($self, $file) = @_; 20 | 21 | my $handle; 22 | if (ref(\$file) eq 'SCALAR') { 23 | #filename 24 | open($handle, "<", $file) || die "FATAL: cannot open '$file': $!"; 25 | binmode($handle); 26 | } 27 | else { 28 | #handle 29 | $handle = $file 30 | } 31 | die "FATAL: invalid handle" unless defined $handle; 32 | 33 | my $n; 34 | my $buf = ""; 35 | while (($n = read($handle, $buf, 32*1024))) { 36 | $self->_add_single($buf) 37 | } 38 | die "FATAL: read failed: $!" unless defined $n; 39 | 40 | return $self; 41 | } 42 | 43 | sub CLONE_SKIP { 1 } # prevent cloning 44 | 45 | 1; 46 | 47 | __END__ 48 | 49 | =head1 NAME 50 | 51 | Crypt::mode - [internal only] 52 | 53 | =cut -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mac/F9.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mac::F9; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use base qw(Crypt::Mac Exporter); 10 | our %EXPORT_TAGS = ( all => [qw( f9 f9_hex f9_b64 f9_b64u )] ); 11 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 12 | our @EXPORT = qw(); 13 | 14 | use CryptX; 15 | use Crypt::Cipher; 16 | 17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } 18 | sub f9 { Crypt::Mac::F9->new(shift, shift)->add(@_)->mac } 19 | sub f9_hex { Crypt::Mac::F9->new(shift, shift)->add(@_)->hexmac } 20 | sub f9_b64 { Crypt::Mac::F9->new(shift, shift)->add(@_)->b64mac } 21 | sub f9_b64u { Crypt::Mac::F9->new(shift, shift)->add(@_)->b64umac } 22 | 23 | 1; 24 | 25 | =pod 26 | 27 | =head1 NAME 28 | 29 | Crypt::Mac::F9 - Message authentication code F9 30 | 31 | =head1 SYNOPSIS 32 | 33 | ### Functional interface: 34 | use Crypt::Mac::F9 qw( f9 f9_hex ); 35 | 36 | # calculate MAC from string/buffer 37 | $f9_raw = f9($cipher_name, $key, 'data buffer'); 38 | $f9_hex = f9_hex($cipher_name, $key, 'data buffer'); 39 | $f9_b64 = f9_b64($cipher_name, $key, 'data buffer'); 40 | $f9_b64u = f9_b64u($cipher_name, $key, 'data buffer'); 41 | 42 | ### OO interface: 43 | use Crypt::Mac::F9; 44 | 45 | $d = Crypt::Mac::F9->new($cipher_name, $key); 46 | $d->add('any data'); 47 | $d->addfile('filename.dat'); 48 | $d->addfile(*FILEHANDLE); 49 | $result_raw = $d->mac; # raw bytes 50 | $result_hex = $d->hexmac; # hexadecimal form 51 | $result_b64 = $d->b64mac; # Base64 form 52 | $result_b64u = $d->b64umac; # Base64 URL Safe form 53 | 54 | =head1 DESCRIPTION 55 | 56 | Provides an interface to the F9 message authentication code (MAC) algorithm. 57 | 58 | =head1 EXPORT 59 | 60 | Nothing is exported by default. 61 | 62 | You can export selected functions: 63 | 64 | use Crypt::Mac::F9 qw(f9 f9_hex ); 65 | 66 | Or all of them at once: 67 | 68 | use Crypt::Mac::F9 ':all'; 69 | 70 | =head1 FUNCTIONS 71 | 72 | =head2 f9 73 | 74 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a binary string. 75 | 76 | $f9_raw = f9($cipher_name, $key, 'data buffer'); 77 | #or 78 | $f9_raw = f9($cipher_name, $key, 'any data', 'more data', 'even more data'); 79 | 80 | =head2 f9_hex 81 | 82 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a hexadecimal string. 83 | 84 | $f9_hex = f9_hex($cipher_name, $key, 'data buffer'); 85 | #or 86 | $f9_hex = f9_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); 87 | 88 | =head2 f9_b64 89 | 90 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a Base64 string. 91 | 92 | $f9_b64 = f9_b64($cipher_name, $key, 'data buffer'); 93 | #or 94 | $f9_b64 = f9_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); 95 | 96 | =head2 f9_b64u 97 | 98 | Logically joins all arguments into a single string, and returns its F9 message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). 99 | 100 | $f9_b64url = f9_b64u($cipher_name, $key, 'data buffer'); 101 | #or 102 | $f9_b64url = f9_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); 103 | 104 | =head1 METHODS 105 | 106 | =head2 new 107 | 108 | $d = Crypt::Mac::F9->new($cipher_name, $key); 109 | 110 | =head2 clone 111 | 112 | $d->clone(); 113 | 114 | =head2 reset 115 | 116 | $d->reset(); 117 | 118 | =head2 add 119 | 120 | $d->add('any data'); 121 | #or 122 | $d->add('any data', 'more data', 'even more data'); 123 | 124 | =head2 addfile 125 | 126 | $d->addfile('filename.dat'); 127 | #or 128 | $d->addfile(*FILEHANDLE); 129 | 130 | =head2 mac 131 | 132 | $result_raw = $d->mac(); 133 | 134 | =head2 hexmac 135 | 136 | $result_hex = $d->hexmac(); 137 | 138 | =head2 b64mac 139 | 140 | $result_b64 = $d->b64mac(); 141 | 142 | =head2 b64umac 143 | 144 | $result_b64url = $d->b64umac(); 145 | 146 | =head1 SEE ALSO 147 | 148 | =over 149 | 150 | =item * L 151 | 152 | =back 153 | 154 | =cut 155 | 156 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mac/Pelican.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mac::Pelican; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use base qw(Crypt::Mac Exporter); 10 | our %EXPORT_TAGS = ( all => [qw( pelican pelican_hex pelican_b64 pelican_b64u )] ); 11 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 12 | our @EXPORT = qw(); 13 | 14 | use CryptX; 15 | sub new { my $class = shift; _new(@_) } 16 | sub pelican { Crypt::Mac::Pelican->new(shift)->add(@_)->mac } 17 | sub pelican_hex { Crypt::Mac::Pelican->new(shift)->add(@_)->hexmac } 18 | sub pelican_b64 { Crypt::Mac::Pelican->new(shift)->add(@_)->b64mac } 19 | sub pelican_b64u { Crypt::Mac::Pelican->new(shift)->add(@_)->b64umac } 20 | 21 | 1; 22 | 23 | =pod 24 | 25 | =head1 NAME 26 | 27 | Crypt::Mac::Pelican - Message authentication code Pelican (AES based MAC) 28 | 29 | =head1 SYNOPSIS 30 | 31 | ### Functional interface: 32 | use Crypt::Mac::Pelican qw( pelican pelican_hex ); 33 | 34 | # calculate MAC from string/buffer 35 | $pelican_raw = pelican($key, 'data buffer'); 36 | $pelican_hex = pelican_hex($key, 'data buffer'); 37 | $pelican_b64 = pelican_b64($key, 'data buffer'); 38 | $pelican_b64u = pelican_b64u($key, 'data buffer'); 39 | 40 | ### OO interface: 41 | use Crypt::Mac::Pelican; 42 | 43 | $d = Crypt::Mac::Pelican->new($key); 44 | $d->add('any data'); 45 | $d->addfile('filename.dat'); 46 | $d->addfile(*FILEHANDLE); 47 | $result_raw = $d->mac; # raw bytes 48 | $result_hex = $d->hexmac; # hexadecimal form 49 | $result_b64 = $d->b64mac; # Base64 form 50 | $result_b64u = $d->b64umac; # Base64 URL Safe form 51 | 52 | =head1 DESCRIPTION 53 | 54 | Provides an interface to the Pelican message authentication code (MAC) algorithm. 55 | 56 | =head1 EXPORT 57 | 58 | Nothing is exported by default. 59 | 60 | You can export selected functions: 61 | 62 | use Crypt::Mac::Pelican qw(pelican pelican_hex ); 63 | 64 | Or all of them at once: 65 | 66 | use Crypt::Mac::Pelican ':all'; 67 | 68 | =head1 FUNCTIONS 69 | 70 | =head2 pelican 71 | 72 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a binary string. 73 | 74 | $pelican_raw = pelican($key, 'data buffer'); 75 | #or 76 | $pelican_raw = pelican($key, 'any data', 'more data', 'even more data'); 77 | 78 | =head2 pelican_hex 79 | 80 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a hexadecimal string. 81 | 82 | $pelican_hex = pelican_hex($key, 'data buffer'); 83 | #or 84 | $pelican_hex = pelican_hex($key, 'any data', 'more data', 'even more data'); 85 | 86 | =head2 pelican_b64 87 | 88 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a Base64 string. 89 | 90 | $pelican_b64 = pelican_b64($key, 'data buffer'); 91 | #or 92 | $pelican_b64 = pelican_b64($key, 'any data', 'more data', 'even more data'); 93 | 94 | =head2 pelican_b64u 95 | 96 | Logically joins all arguments into a single string, and returns its Pelican message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). 97 | 98 | $pelican_b64url = pelican_b64u($key, 'data buffer'); 99 | #or 100 | $pelican_b64url = pelican_b64u($key, 'any data', 'more data', 'even more data'); 101 | 102 | =head1 METHODS 103 | 104 | =head2 new 105 | 106 | $d = Crypt::Mac::Pelican->new($key); 107 | 108 | =head2 clone 109 | 110 | $d->clone(); 111 | 112 | =head2 reset 113 | 114 | $d->reset(); 115 | 116 | =head2 add 117 | 118 | $d->add('any data'); 119 | #or 120 | $d->add('any data', 'more data', 'even more data'); 121 | 122 | =head2 addfile 123 | 124 | $d->addfile('filename.dat'); 125 | #or 126 | $d->addfile(*FILEHANDLE); 127 | 128 | =head2 mac 129 | 130 | $result_raw = $d->mac(); 131 | 132 | =head2 hexmac 133 | 134 | $result_hex = $d->hexmac(); 135 | 136 | =head2 b64mac 137 | 138 | $result_b64 = $d->b64mac(); 139 | 140 | =head2 b64umac 141 | 142 | $result_b64url = $d->b64umac(); 143 | 144 | =head1 SEE ALSO 145 | 146 | =over 147 | 148 | =item * L 149 | 150 | =item * L 151 | 152 | =back 153 | 154 | =cut 155 | 156 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mac/Poly1305.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mac::Poly1305; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use base qw(Crypt::Mac Exporter); 10 | our %EXPORT_TAGS = ( all => [qw( poly1305 poly1305_hex poly1305_b64 poly1305_b64u )] ); 11 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 12 | our @EXPORT = qw(); 13 | 14 | use CryptX; 15 | sub new { my $class = shift; _new(@_) } 16 | sub poly1305 { Crypt::Mac::Poly1305->new(shift)->add(@_)->mac } 17 | sub poly1305_hex { Crypt::Mac::Poly1305->new(shift)->add(@_)->hexmac } 18 | sub poly1305_b64 { Crypt::Mac::Poly1305->new(shift)->add(@_)->b64mac } 19 | sub poly1305_b64u { Crypt::Mac::Poly1305->new(shift)->add(@_)->b64umac } 20 | 21 | 1; 22 | 23 | =pod 24 | 25 | =head1 NAME 26 | 27 | Crypt::Mac::Poly1305 - Message authentication code Poly1305 (RFC 7539) 28 | 29 | =head1 SYNOPSIS 30 | 31 | ### Functional interface: 32 | use Crypt::Mac::Poly1305 qw( poly1305 poly1305_hex ); 33 | 34 | # calculate MAC from string/buffer 35 | $poly1305_raw = poly1305($key, 'data buffer'); 36 | $poly1305_hex = poly1305_hex($key, 'data buffer'); 37 | $poly1305_b64 = poly1305_b64($key, 'data buffer'); 38 | $poly1305_b64u = poly1305_b64u($key, 'data buffer'); 39 | 40 | ### OO interface: 41 | use Crypt::Mac::Poly1305; 42 | 43 | $d = Crypt::Mac::Poly1305->new($key); 44 | $d->add('any data'); 45 | $d->addfile('filename.dat'); 46 | $d->addfile(*FILEHANDLE); 47 | $result_raw = $d->mac; # raw bytes 48 | $result_hex = $d->hexmac; # hexadecimal form 49 | $result_b64 = $d->b64mac; # Base64 form 50 | $result_b64u = $d->b64umac; # Base64 URL Safe form 51 | 52 | =head1 DESCRIPTION 53 | 54 | Provides an interface to the Poly1305 message authentication code (MAC) algorithm. 55 | 56 | =head1 EXPORT 57 | 58 | Nothing is exported by default. 59 | 60 | You can export selected functions: 61 | 62 | use Crypt::Mac::Poly1305 qw(poly1305 poly1305_hex ); 63 | 64 | Or all of them at once: 65 | 66 | use Crypt::Mac::Poly1305 ':all'; 67 | 68 | =head1 FUNCTIONS 69 | 70 | =head2 poly1305 71 | 72 | Logically joins all arguments into a single string, and returns its Poly1305 message authentication code encoded as a binary string. 73 | 74 | $poly1305_raw = poly1305($key, 'data buffer'); 75 | #or 76 | $poly1305_raw = poly1305($key, 'any data', 'more data', 'even more data'); 77 | 78 | =head2 poly1305_hex 79 | 80 | Logically joins all arguments into a single string, and returns its Poly1305 message authentication code encoded as a hexadecimal string. 81 | 82 | $poly1305_hex = poly1305_hex($key, 'data buffer'); 83 | #or 84 | $poly1305_hex = poly1305_hex($key, 'any data', 'more data', 'even more data'); 85 | 86 | =head2 poly1305_b64 87 | 88 | Logically joins all arguments into a single string, and returns its Poly1305 message authentication code encoded as a Base64 string. 89 | 90 | $poly1305_b64 = poly1305_b64($key, 'data buffer'); 91 | #or 92 | $poly1305_b64 = poly1305_b64($key, 'any data', 'more data', 'even more data'); 93 | 94 | =head2 poly1305_b64u 95 | 96 | Logically joins all arguments into a single string, and returns its Poly1305 message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). 97 | 98 | $poly1305_b64url = poly1305_b64u($key, 'data buffer'); 99 | #or 100 | $poly1305_b64url = poly1305_b64u($key, 'any data', 'more data', 'even more data'); 101 | 102 | =head1 METHODS 103 | 104 | =head2 new 105 | 106 | $d = Crypt::Mac::Poly1305->new($key); 107 | 108 | =head2 clone 109 | 110 | $d->clone(); 111 | 112 | =head2 reset 113 | 114 | $d->reset(); 115 | 116 | =head2 add 117 | 118 | $d->add('any data'); 119 | #or 120 | $d->add('any data', 'more data', 'even more data'); 121 | 122 | =head2 addfile 123 | 124 | $d->addfile('filename.dat'); 125 | #or 126 | $d->addfile(*FILEHANDLE); 127 | 128 | =head2 mac 129 | 130 | $result_raw = $d->mac(); 131 | 132 | =head2 hexmac 133 | 134 | $result_hex = $d->hexmac(); 135 | 136 | =head2 b64mac 137 | 138 | $result_b64 = $d->b64mac(); 139 | 140 | =head2 b64umac 141 | 142 | $result_b64url = $d->b64umac(); 143 | 144 | =head1 SEE ALSO 145 | 146 | =over 147 | 148 | =item * L 149 | 150 | =item * L 151 | 152 | =back 153 | 154 | =cut 155 | 156 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mac/XCBC.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mac::XCBC; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use base qw(Crypt::Mac Exporter); 10 | our %EXPORT_TAGS = ( all => [qw( xcbc xcbc_hex xcbc_b64 xcbc_b64u )] ); 11 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 12 | our @EXPORT = qw(); 13 | 14 | use CryptX; 15 | use Crypt::Cipher; 16 | 17 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } 18 | sub xcbc { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->mac } 19 | sub xcbc_hex { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->hexmac } 20 | sub xcbc_b64 { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->b64mac } 21 | sub xcbc_b64u { Crypt::Mac::XCBC->new(shift, shift)->add(@_)->b64umac } 22 | 23 | 1; 24 | 25 | =pod 26 | 27 | =head1 NAME 28 | 29 | Crypt::Mac::XCBC - Message authentication code XCBC (RFC 3566) 30 | 31 | =head1 SYNOPSIS 32 | 33 | ### Functional interface: 34 | use Crypt::Mac::XCBC qw( xcbc xcbc_hex ); 35 | 36 | # calculate MAC from string/buffer 37 | $xcbc_raw = xcbc($cipher_name, $key, 'data buffer'); 38 | $xcbc_hex = xcbc_hex($cipher_name, $key, 'data buffer'); 39 | $xcbc_b64 = xcbc_b64($cipher_name, $key, 'data buffer'); 40 | $xcbc_b64u = xcbc_b64u($cipher_name, $key, 'data buffer'); 41 | 42 | ### OO interface: 43 | use Crypt::Mac::XCBC; 44 | 45 | $d = Crypt::Mac::XCBC->new($cipher_name, $key); 46 | $d->add('any data'); 47 | $d->addfile('filename.dat'); 48 | $d->addfile(*FILEHANDLE); 49 | $result_raw = $d->mac; # raw bytes 50 | $result_hex = $d->hexmac; # hexadecimal form 51 | $result_b64 = $d->b64mac; # Base64 form 52 | $result_b64u = $d->b64umac; # Base64 URL Safe form 53 | 54 | =head1 DESCRIPTION 55 | 56 | Provides an interface to the XCBC message authentication code (MAC) algorithm. 57 | 58 | =head1 EXPORT 59 | 60 | Nothing is exported by default. 61 | 62 | You can export selected functions: 63 | 64 | use Crypt::Mac::XCBC qw(xcbc xcbc_hex ); 65 | 66 | Or all of them at once: 67 | 68 | use Crypt::Mac::XCBC ':all'; 69 | 70 | =head1 FUNCTIONS 71 | 72 | =head2 xcbc 73 | 74 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a binary string. 75 | 76 | $xcbc_raw = xcbc($cipher_name, $key, 'data buffer'); 77 | #or 78 | $xcbc_raw = xcbc($cipher_name, $key, 'any data', 'more data', 'even more data'); 79 | 80 | =head2 xcbc_hex 81 | 82 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a hexadecimal string. 83 | 84 | $xcbc_hex = xcbc_hex($cipher_name, $key, 'data buffer'); 85 | #or 86 | $xcbc_hex = xcbc_hex($cipher_name, $key, 'any data', 'more data', 'even more data'); 87 | 88 | =head2 xcbc_b64 89 | 90 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a Base64 string. 91 | 92 | $xcbc_b64 = xcbc_b64($cipher_name, $key, 'data buffer'); 93 | #or 94 | $xcbc_b64 = xcbc_b64($cipher_name, $key, 'any data', 'more data', 'even more data'); 95 | 96 | =head2 xcbc_b64u 97 | 98 | Logically joins all arguments into a single string, and returns its XCBC message authentication code encoded as a Base64 URL Safe string (see RFC 4648 section 5). 99 | 100 | $xcbc_b64url = xcbc_b64u($cipher_name, $key, 'data buffer'); 101 | #or 102 | $xcbc_b64url = xcbc_b64u($cipher_name, $key, 'any data', 'more data', 'even more data'); 103 | 104 | =head1 METHODS 105 | 106 | =head2 new 107 | 108 | $d = Crypt::Mac::XCBC->new($cipher_name, $key); 109 | 110 | =head2 clone 111 | 112 | $d->clone(); 113 | 114 | =head2 reset 115 | 116 | $d->reset(); 117 | 118 | =head2 add 119 | 120 | $d->add('any data'); 121 | #or 122 | $d->add('any data', 'more data', 'even more data'); 123 | 124 | =head2 addfile 125 | 126 | $d->addfile('filename.dat'); 127 | #or 128 | $d->addfile(*FILEHANDLE); 129 | 130 | =head2 mac 131 | 132 | $result_raw = $d->mac(); 133 | 134 | =head2 hexmac 135 | 136 | $result_hex = $d->hexmac(); 137 | 138 | =head2 b64mac 139 | 140 | $result_b64 = $d->b64mac(); 141 | 142 | =head2 b64umac 143 | 144 | $result_b64url = $d->b64umac(); 145 | 146 | =head1 SEE ALSO 147 | 148 | =over 149 | 150 | =item * L 151 | 152 | =item * L 153 | 154 | =back 155 | 156 | =cut 157 | 158 | __END__ -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mode.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mode; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | ### METHODS 8 | 9 | sub new { die } # overriden in subclass 10 | 11 | sub encrypt { 12 | my ($self, $pt) = (shift, shift); 13 | $self->_start(1, @_); 14 | return $self->add($pt) . $self->finish; 15 | } 16 | 17 | sub decrypt { 18 | my ($self, $ct) = (shift, shift); 19 | $self->_start(-1, @_); 20 | return $self->add($ct) . $self->finish; 21 | } 22 | 23 | sub start_encrypt { 24 | my $self = shift; 25 | $self->_start(1, @_); 26 | return $self; 27 | } 28 | 29 | sub start_decrypt { 30 | my $self = shift; 31 | $self->_start(-1, @_); 32 | return $self; 33 | } 34 | 35 | sub finish { 36 | shift->_finish(@_); 37 | } 38 | 39 | sub add { 40 | my $self = shift; 41 | my $rv = ''; 42 | $rv .= $self->_crypt($_) for (@_); 43 | return $rv; 44 | } 45 | 46 | sub _crypt { 47 | my $self = shift; 48 | my $dir = $self->_get_dir; 49 | return $self->_encrypt(@_) if $dir == 1; 50 | return $self->_decrypt(@_) if $dir == -1; 51 | return; 52 | } 53 | 54 | sub _finish { 55 | my $self = shift; 56 | my $dir = $self->_get_dir; 57 | return $self->_finish_enc(@_) if $dir == 1; 58 | return $self->_finish_dec(@_) if $dir == -1; 59 | return; 60 | } 61 | 62 | sub CLONE_SKIP { 1 } # prevent cloning 63 | 64 | 1; 65 | 66 | __END__ 67 | 68 | =head1 NAME 69 | 70 | Crypt::Mode - [internal only] 71 | 72 | =cut -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mode/CBC.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mode::CBC; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use Crypt::Cipher; 10 | use base 'Crypt::Mode'; 11 | 12 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } 13 | 14 | 1; 15 | 16 | =pod 17 | 18 | =head1 NAME 19 | 20 | Crypt::Mode::CBC - Block cipher mode CBC [Cipher-block chaining] 21 | 22 | =head1 SYNOPSIS 23 | 24 | use Crypt::Mode::CBC; 25 | my $m = Crypt::Mode::CBC->new('AES'); 26 | 27 | #(en|de)crypt at once 28 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); 29 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); 30 | 31 | #encrypt more chunks 32 | $m->start_encrypt($key, $iv); 33 | my $ciphertext = $m->add('some data'); 34 | $ciphertext .= $m->add('more data'); 35 | $ciphertext .= $m->finish; 36 | 37 | #decrypt more chunks 38 | $m->start_decrypt($key, $iv); 39 | my $plaintext = $m->add($some_ciphertext); 40 | $plaintext .= $m->add($more_ciphertext); 41 | $plaintext .= $m->finish; 42 | 43 | =head1 DESCRIPTION 44 | 45 | This module implements CBC cipher mode. B it works only with ciphers from L (Crypt::Cipher::NNNN). 46 | 47 | =head1 METHODS 48 | 49 | =head2 new 50 | 51 | my $m = Crypt::Mode::CBC->new('AES'); 52 | #or 53 | my $m = Crypt::Mode::CBC->new('AES', $padding); 54 | #or 55 | my $m = Crypt::Mode::CBC->new('AES', $padding, $cipher_rounds); 56 | 57 | # $padding .... 0 no padding (plaintext size has to be myltiple of block length) 58 | # 1 PKCS5 padding, Crypt::CBC's "standard" - DEFAULT 59 | # 2 Crypt::CBC's "oneandzeroes" 60 | # $cipher_rounds ... optional num of rounds for given cipher 61 | 62 | =head2 encrypt 63 | 64 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); 65 | 66 | =head2 decrypt 67 | 68 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); 69 | 70 | =head2 start_encrypt 71 | 72 | See example below L. 73 | 74 | =head2 start_decrypt 75 | 76 | See example below L. 77 | 78 | =head2 add 79 | 80 | See example below L. 81 | 82 | =head2 finish 83 | 84 | #encrypt more chunks 85 | $m->start_encrypt($key, $iv); 86 | my $ciphertext = ''; 87 | $ciphertext .= $m->add('some data'); 88 | $ciphertext .= $m->add('more data'); 89 | $ciphertext .= $m->finish; 90 | 91 | #decrypt more chunks 92 | $m->start_decrypt($key, $iv); 93 | my $plaintext = ''; 94 | $plaintext .= $m->add($some_ciphertext); 95 | $plaintext .= $m->add($more_ciphertext); 96 | $plaintext .= $m->finish; 97 | 98 | =head1 SEE ALSO 99 | 100 | =over 101 | 102 | =item * L, L 103 | 104 | =item * L, L, ... 105 | 106 | =item * L 107 | 108 | =back 109 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mode/CFB.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mode::CFB; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use Crypt::Cipher; 10 | use base 'Crypt::Mode'; 11 | 12 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } 13 | 14 | 1; 15 | 16 | =pod 17 | 18 | =head1 NAME 19 | 20 | Crypt::Mode::CFB - Block cipher mode CFB [Cipher feedback] 21 | 22 | =head1 SYNOPSIS 23 | 24 | use Crypt::Mode::CFB; 25 | my $m = Crypt::Mode::CFB->new('AES'); 26 | 27 | #(en|de)crypt at once 28 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); 29 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); 30 | 31 | #encrypt more chunks 32 | $m->start_encrypt($key, $iv); 33 | my $ciphertext = $m->add('some data'); 34 | $ciphertext .= $m->add('more data'); 35 | 36 | #decrypt more chunks 37 | $m->start_decrypt($key, $iv); 38 | my $plaintext = $m->add($some_ciphertext); 39 | $plaintext .= $m->add($more_ciphertext); 40 | 41 | =head1 DESCRIPTION 42 | 43 | This module implements CFB cipher mode. B it works only with ciphers from L (Crypt::Cipher::NNNN). 44 | 45 | =head1 METHODS 46 | 47 | =head2 new 48 | 49 | my $m = Crypt::Mode::CFB->new('AES'); 50 | #or 51 | my $m = Crypt::Mode::CFB->new('AES', $cipher_rounds); 52 | 53 | # $cipher_rounds ... optional num of rounds for given cipher 54 | 55 | =head2 encrypt 56 | 57 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); 58 | 59 | =head2 decrypt 60 | 61 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); 62 | 63 | =head2 start_encrypt 64 | 65 | See example below L. 66 | 67 | =head2 start_decrypt 68 | 69 | See example below L. 70 | 71 | =head2 add 72 | 73 | See example below L. 74 | 75 | =head2 finish 76 | 77 | #encrypt more chunks 78 | $m->start_encrypt($key, $iv); 79 | my $ciphertext = ''; 80 | $ciphertext .= $m->add('some data'); 81 | $ciphertext .= $m->add('more data'); 82 | 83 | #decrypt more chunks 84 | $m->start_decrypt($key, $iv); 85 | my $plaintext = ''; 86 | $plaintext .= $m->add($some_ciphertext); 87 | $plaintext .= $m->add($more_ciphertext); 88 | 89 | =head1 SEE ALSO 90 | 91 | =over 92 | 93 | =item * L, L 94 | 95 | =item * L, L, ... 96 | 97 | =item * L 98 | 99 | =back 100 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mode/CTR.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mode::CTR; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use Crypt::Cipher; 10 | use base 'Crypt::Mode'; 11 | 12 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } 13 | 14 | 1; 15 | 16 | =pod 17 | 18 | =head1 NAME 19 | 20 | Crypt::Mode::CTR - Block cipher mode CTR [Counter mode] 21 | 22 | =head1 SYNOPSIS 23 | 24 | use Crypt::Mode::CTR; 25 | my $m = Crypt::Mode::CTR->new('AES'); 26 | 27 | #(en|de)crypt at once 28 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); 29 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); 30 | 31 | #encrypt more chunks 32 | $m->start_encrypt($key, $iv); 33 | my $ciphertext = $m->add('some data'); 34 | $ciphertext .= $m->add('more data'); 35 | 36 | #decrypt more chunks 37 | $m->start_decrypt($key, $iv); 38 | my $plaintext = $m->add($some_ciphertext); 39 | $plaintext .= $m->add($more_ciphertext); 40 | 41 | =head1 DESCRIPTION 42 | 43 | This module implements CTR cipher mode. B it works only with ciphers from L (Crypt::Cipher::NNNN). 44 | 45 | =head1 METHODS 46 | 47 | =head2 new 48 | 49 | my $m = Crypt::Mode::CTR->new($cipher_name); 50 | #or 51 | my $m = Crypt::Mode::CTR->new($cipher_name, $ctr_mode, $ctr_width); 52 | #or 53 | my $m = Crypt::Mode::CTR->new($cipher_name, $ctr_mode, $ctr_width, $cipher_rounds); 54 | 55 | # $ctr_mode .... 0 little-endian counter (DEFAULT) 56 | # 1 big-endian counter 57 | # 2 little-endian + RFC3686 incrementing 58 | # 3 big-endian + RFC3686 incrementing 59 | # $ctr_width ... counter width in bytes (DEFAULT = full block width) 60 | # $cipher_rounds ... optional num of rounds for given cipher 61 | 62 | =head2 encrypt 63 | 64 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); 65 | 66 | =head2 decrypt 67 | 68 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); 69 | 70 | =head2 start_encrypt 71 | 72 | See example below L. 73 | 74 | =head2 start_decrypt 75 | 76 | See example below L. 77 | 78 | =head2 add 79 | 80 | See example below L. 81 | 82 | =head2 finish 83 | 84 | #encrypt more chunks 85 | $m->start_encrypt($key, $iv); 86 | my $ciphertext = ''; 87 | $ciphertext .= $m->add('some data'); 88 | $ciphertext .= $m->add('more data'); 89 | 90 | #decrypt more chunks 91 | $m->start_decrypt($key, $iv); 92 | my $plaintext = ''; 93 | $plaintext .= $m->add($some_ciphertext); 94 | $plaintext .= $m->add($more_ciphertext); 95 | 96 | =head1 SEE ALSO 97 | 98 | =over 99 | 100 | =item * L, L 101 | 102 | =item * L, L, ... 103 | 104 | =item * L 105 | 106 | =back 107 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mode/ECB.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mode::ECB; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use Crypt::Cipher; 10 | use base 'Crypt::Mode'; 11 | 12 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } 13 | 14 | 1; 15 | 16 | =pod 17 | 18 | =head1 NAME 19 | 20 | Crypt::Mode::ECB - Block cipher mode ECB [Electronic codebook] 21 | 22 | =head1 SYNOPSIS 23 | 24 | use Crypt::Mode::ECB; 25 | my $m = Crypt::Mode::ECB->new('AES'); 26 | 27 | #(en|de)crypt at once 28 | my $ciphertext = $m->encrypt($plaintext, $key); 29 | my $plaintext = $m->decrypt($ciphertext, $key); 30 | 31 | #encrypt more chunks 32 | $m->start_encrypt($key); 33 | my $ciphertext = $m->add('some data'); 34 | $ciphertext .= $m->add('more data'); 35 | $ciphertext .= $m->finish; 36 | 37 | #decrypt more chunks 38 | $m->start_decrypt($key); 39 | my $plaintext = $m->add($some_ciphertext); 40 | $plaintext .= $m->add($more_ciphertext); 41 | $plaintext .= $m->finish; 42 | 43 | =head1 DESCRIPTION 44 | 45 | This module implements ECB cipher mode. B it works only with ciphers from L (Crypt::Cipher::NNNN). 46 | B, if you are not sure go for L! 47 | 48 | =head1 METHODS 49 | 50 | =head2 new 51 | 52 | my $m = Crypt::Mode::ECB->new('AES'); 53 | #or 54 | my $m = Crypt::Mode::ECB->new('AES', $padding); 55 | #or 56 | my $m = Crypt::Mode::ECB->new('AES', $padding, $cipher_rounds); 57 | 58 | # $padding .... 0 no padding (plaintext size has to be myltiple of block length) 59 | # 1 PKCS5 padding, Crypt::CBC's "standard" - DEFAULT 60 | # 2 Crypt::CBC's "oneandzeroes" 61 | # $cipher_rounds ... optional num of rounds for given cipher 62 | 63 | =head2 encrypt 64 | 65 | my $ciphertext = $m->encrypt($plaintext, $key); 66 | 67 | =head2 decrypt 68 | 69 | my $plaintext = $m->decrypt($ciphertext, $key); 70 | 71 | =head2 start_encrypt 72 | 73 | See example below L. 74 | 75 | =head2 start_decrypt 76 | 77 | See example below L. 78 | 79 | =head2 add 80 | 81 | See example below L. 82 | 83 | =head2 finish 84 | 85 | #encrypt more chunks 86 | $m->start_encrypt($key); 87 | my $ciphertext = ''; 88 | $ciphertext .= $m->add('some data'); 89 | $ciphertext .= $m->add('more data'); 90 | $ciphertext .= $m->finish; 91 | 92 | #decrypt more chunks 93 | $m->start_decrypt($key); 94 | my $plaintext = ''; 95 | $plaintext .= $m->add($some_ciphertext); 96 | $plaintext .= $m->add($more_ciphertext); 97 | $plaintext .= $m->finish; 98 | 99 | =head1 SEE ALSO 100 | 101 | =over 102 | 103 | =item * L, L 104 | 105 | =item * L, L, ... 106 | 107 | =item * L 108 | 109 | =back 110 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/Mode/OFB.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Mode::OFB; 2 | 3 | ### BEWARE - GENERATED FILE, DO NOT EDIT MANUALLY! 4 | 5 | use strict; 6 | use warnings; 7 | our $VERSION = '0.048'; 8 | 9 | use Crypt::Cipher; 10 | use base 'Crypt::Mode'; 11 | 12 | sub new { my $class = shift; _new(Crypt::Cipher::_trans_cipher_name(shift), @_) } 13 | 14 | 1; 15 | 16 | =pod 17 | 18 | =head1 NAME 19 | 20 | Crypt::Mode::OFB - Block cipher mode OFB [Output feedback] 21 | 22 | =head1 SYNOPSIS 23 | 24 | use Crypt::Mode::OFB; 25 | my $m = Crypt::Mode::OFB->new('AES'); 26 | 27 | #(en|de)crypt at once 28 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); 29 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); 30 | 31 | #encrypt more chunks 32 | $m->start_encrypt($key, $iv); 33 | my $ciphertext = $m->add('some data'); 34 | $ciphertext .= $m->add('more data'); 35 | 36 | #decrypt more chunks 37 | $m->start_decrypt($key, $iv); 38 | my $plaintext = $m->add($some_ciphertext); 39 | $plaintext .= $m->add($more_ciphertext); 40 | 41 | =head1 DESCRIPTION 42 | 43 | This module implements OFB cipher mode. B it works only with ciphers from L (Crypt::Cipher::NNNN). 44 | 45 | =head1 METHODS 46 | 47 | =head2 new 48 | 49 | my $m = Crypt::Mode::OFB->new('AES'); 50 | #or 51 | my $m = Crypt::Mode::OFB->new('AES', $cipher_rounds); 52 | 53 | # $cipher_rounds ... optional num of rounds for given cipher 54 | 55 | =head2 encrypt 56 | 57 | my $ciphertext = $m->encrypt($plaintext, $key, $iv); 58 | 59 | =head2 decrypt 60 | 61 | my $plaintext = $m->decrypt($ciphertext, $key, $iv); 62 | 63 | =head2 start_encrypt 64 | 65 | See example below L. 66 | 67 | =head2 start_decrypt 68 | 69 | See example below L. 70 | 71 | =head2 add 72 | 73 | See example below L. 74 | 75 | =head2 finish 76 | 77 | #encrypt more chunks 78 | $m->start_encrypt($key, $iv); 79 | my $ciphertext = ''; 80 | $ciphertext .= $m->add('some data'); 81 | $ciphertext .= $m->add('more data'); 82 | 83 | #decrypt more chunks 84 | $m->start_decrypt($key, $iv); 85 | my $plaintext = ''; 86 | $plaintext .= $m->add($some_ciphertext); 87 | $plaintext .= $m->add($more_ciphertext); 88 | 89 | =head1 SEE ALSO 90 | 91 | =over 92 | 93 | =item * L, L 94 | 95 | =item * L, L, ... 96 | 97 | =item * L 98 | 99 | =back 100 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/PK.pm: -------------------------------------------------------------------------------- 1 | package Crypt::PK; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use Carp; 8 | 9 | sub _ssh_parse { 10 | my $raw = shift; 11 | return unless defined $raw; 12 | my $len = length($raw); 13 | my @parts = (); 14 | my $i = 0; 15 | while (1) { 16 | last unless $i + 4 <= $len; 17 | my $part_len = unpack("N4", substr($raw, $i, 4)); 18 | last unless $i + 4 + $part_len <= $len; 19 | push @parts, substr($raw, $i + 4, $part_len); 20 | $i += $part_len + 4; 21 | } 22 | return @parts; 23 | } 24 | 25 | 1; 26 | 27 | __END__ 28 | 29 | =head1 NAME 30 | 31 | Crypt::PK - [internal only] 32 | 33 | =cut -------------------------------------------------------------------------------- /pairing/lib/Crypt/PRNG/ChaCha20.pm: -------------------------------------------------------------------------------- 1 | package Crypt::PRNG::ChaCha20; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use base qw(Crypt::PRNG Exporter); 8 | our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] ); 9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 10 | our @EXPORT = qw(); 11 | 12 | use CryptX; 13 | use base 'Crypt::PRNG'; 14 | 15 | { 16 | ### stolen from Bytes::Random::Secure 17 | my $RNG_object = undef; 18 | my $fetch_RNG = sub { # Lazily, instantiate the RNG object, but only once. 19 | $RNG_object = Crypt::PRNG::ChaCha20->new unless defined $RNG_object && ref($RNG_object) ne 'SCALAR'; 20 | return $RNG_object; 21 | }; 22 | sub rand { return $fetch_RNG->()->double(@_) } 23 | sub irand { return $fetch_RNG->()->int32(@_) } 24 | sub random_bytes { return $fetch_RNG->()->bytes(@_) } 25 | sub random_bytes_hex { return $fetch_RNG->()->bytes_hex(@_) } 26 | sub random_bytes_b64 { return $fetch_RNG->()->bytes_b64(@_) } 27 | sub random_bytes_b64u { return $fetch_RNG->()->bytes_b64u(@_) } 28 | sub random_string_from { return $fetch_RNG->()->string_from(@_) } 29 | sub random_string { return $fetch_RNG->()->string(@_) } 30 | } 31 | 32 | 33 | 1; 34 | 35 | =pod 36 | 37 | =head1 NAME 38 | 39 | Crypt::PRNG::ChaCha20 - Cryptographically secure PRNG based on ChaCha20 (stream cipher) algorithm 40 | 41 | =head1 SYNOPSIS 42 | 43 | ### Functional interface: 44 | use Crypt::PRNG::ChaCha20 qw(random_bytes random_bytes_hex random_bytes_b64 random_string random_string_from rand irand); 45 | 46 | $octets = random_bytes(45); 47 | $hex_string = random_bytes_hex(45); 48 | $base64_string = random_bytes_b64(45); 49 | $base64url_string = random_bytes_b64u(45); 50 | $alphanumeric_string = random_string(30); 51 | $string = random_string_from('ACGT', 64); 52 | $floating_point_number_0_to_1 = rand; 53 | $floating_point_number_0_to_88 = rand(88); 54 | $unsigned_32bit_int = irand; 55 | 56 | ### OO interface: 57 | use Crypt::PRNG::ChaCha20; 58 | 59 | $prng = Crypt::PRNG::ChaCha20->new; 60 | #or 61 | $prng = Crypt::PRNG::ChaCha20->new("some data used for seeding PRNG"); 62 | 63 | $octets = $prng->bytes(45); 64 | $hex_string = $prng->bytes_hex(45); 65 | $base64_string = $prng->bytes_b64(45); 66 | $base64url_string = $prng->bytes_b64u(45); 67 | $alphanumeric_string = $prng->string(30); 68 | $string = $prng->string_from('ACGT', 64); 69 | $floating_point_number_0_to_1 = rand; 70 | $floating_point_number_0_to_88 = rand(88); 71 | $unsigned_32bit_int = irand; 72 | 73 | =head1 DESCRIPTION 74 | 75 | Provides an interface to the ChaCha20 based pseudo random number generator 76 | 77 | All methods and functions are the same as for L. 78 | 79 | =head1 FUNCTIONS 80 | 81 | =head2 random_bytes 82 | 83 | See L. 84 | 85 | =head2 random_bytes_hex 86 | 87 | See L. 88 | 89 | =head2 random_bytes_b64 90 | 91 | See L. 92 | 93 | =head2 random_bytes_b64u 94 | 95 | See L. 96 | 97 | =head2 random_string 98 | 99 | See L. 100 | 101 | =head2 random_string_from 102 | 103 | See L. 104 | 105 | =head2 rand 106 | 107 | See L. 108 | 109 | =head2 irand 110 | 111 | See L. 112 | 113 | =head1 METHODS 114 | 115 | =head2 new 116 | 117 | See L. 118 | 119 | =head2 bytes 120 | 121 | See L. 122 | 123 | =head2 bytes_hex 124 | 125 | See L. 126 | 127 | =head2 bytes_b64 128 | 129 | See L. 130 | 131 | =head2 bytes_b64u 132 | 133 | See L. 134 | 135 | =head2 string 136 | 137 | See L. 138 | 139 | =head2 string_from 140 | 141 | See L. 142 | 143 | =head2 double 144 | 145 | See L. 146 | 147 | =head2 int32 148 | 149 | See L. 150 | 151 | =head1 SEE ALSO 152 | 153 | =over 154 | 155 | =item * L 156 | 157 | =item * L 158 | 159 | =back 160 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/PRNG/Fortuna.pm: -------------------------------------------------------------------------------- 1 | package Crypt::PRNG::Fortuna; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use base qw(Crypt::PRNG Exporter); 8 | our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] ); 9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 10 | our @EXPORT = qw(); 11 | 12 | use CryptX; 13 | use base 'Crypt::PRNG'; 14 | 15 | { 16 | ### stolen from Bytes::Random::Secure 17 | my $RNG_object = undef; 18 | my $fetch_RNG = sub { # Lazily, instantiate the RNG object, but only once. 19 | $RNG_object = Crypt::PRNG::Fortuna->new unless defined $RNG_object && ref($RNG_object) ne 'SCALAR'; 20 | return $RNG_object; 21 | }; 22 | sub rand { return $fetch_RNG->()->double(@_) } 23 | sub irand { return $fetch_RNG->()->int32(@_) } 24 | sub random_bytes { return $fetch_RNG->()->bytes(@_) } 25 | sub random_bytes_hex { return $fetch_RNG->()->bytes_hex(@_) } 26 | sub random_bytes_b64 { return $fetch_RNG->()->bytes_b64(@_) } 27 | sub random_bytes_b64u { return $fetch_RNG->()->bytes_b64u(@_) } 28 | sub random_string_from { return $fetch_RNG->()->string_from(@_) } 29 | sub random_string { return $fetch_RNG->()->string(@_) } 30 | } 31 | 32 | 33 | 1; 34 | 35 | =pod 36 | 37 | =head1 NAME 38 | 39 | Crypt::PRNG::Fortuna - Cryptographically secure PRNG based on Fortuna algorithm 40 | 41 | =head1 SYNOPSIS 42 | 43 | ### Functional interface: 44 | use Crypt::PRNG::Fortuna qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u 45 | random_string random_string_from rand irand); 46 | 47 | $octets = random_bytes(45); 48 | $hex_string = random_bytes_hex(45); 49 | $base64_string = random_bytes_b64(45); 50 | $base64url_string = random_bytes_b64u(45); 51 | $alphanumeric_string = random_string(30); 52 | $string = random_string_from('ACGT', 64); 53 | $floating_point_number_0_to_1 = rand; 54 | $floating_point_number_0_to_88 = rand(88); 55 | $unsigned_32bit_int = irand; 56 | 57 | ### OO interface: 58 | use Crypt::PRNG::Fortuna; 59 | 60 | $prng = Crypt::PRNG::Fortuna->new; 61 | #or 62 | $prng = Crypt::PRNG::Fortuna->new("some data used for seeding PRNG"); 63 | 64 | $octets = $prng->bytes(45); 65 | $hex_string = $prng->bytes_hex(45); 66 | $base64_string = $prng->bytes_b64(45); 67 | $base64url_string = $prng->bytes_b64u(45); 68 | $alphanumeric_string = $prng->string(30); 69 | $string = $prng->string_from('ACGT', 64); 70 | $floating_point_number_0_to_1 = rand; 71 | $floating_point_number_0_to_88 = rand(88); 72 | $unsigned_32bit_int = irand; 73 | 74 | =head1 DESCRIPTION 75 | 76 | Provides an interface to the Fortuna based pseudo random number generator 77 | 78 | All methods and functions are the same as for L. 79 | 80 | =head1 FUNCTIONS 81 | 82 | =head2 random_bytes 83 | 84 | See L. 85 | 86 | =head2 random_bytes_hex 87 | 88 | See L. 89 | 90 | =head2 random_bytes_b64 91 | 92 | See L. 93 | 94 | =head2 random_bytes_b64u 95 | 96 | See L. 97 | 98 | =head2 random_string 99 | 100 | See L. 101 | 102 | =head2 random_string_from 103 | 104 | See L. 105 | 106 | =head2 rand 107 | 108 | See L. 109 | 110 | =head2 irand 111 | 112 | See L. 113 | 114 | =head1 METHODS 115 | 116 | =head2 new 117 | 118 | See L. 119 | 120 | =head2 bytes 121 | 122 | See L. 123 | 124 | =head2 bytes_hex 125 | 126 | See L. 127 | 128 | =head2 bytes_b64 129 | 130 | See L. 131 | 132 | =head2 bytes_b64u 133 | 134 | See L. 135 | 136 | =head2 string 137 | 138 | See L. 139 | 140 | =head2 string_from 141 | 142 | See L. 143 | 144 | =head2 double 145 | 146 | See L. 147 | 148 | =head2 int32 149 | 150 | See L. 151 | 152 | =head1 SEE ALSO 153 | 154 | =over 155 | 156 | =item * L 157 | 158 | =item * L 159 | 160 | =back 161 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/PRNG/RC4.pm: -------------------------------------------------------------------------------- 1 | package Crypt::PRNG::RC4; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use base qw(Crypt::PRNG Exporter); 8 | our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] ); 9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 10 | our @EXPORT = qw(); 11 | 12 | use CryptX; 13 | use base 'Crypt::PRNG'; 14 | 15 | { 16 | ### stolen from Bytes::Random::Secure 17 | my $RNG_object = undef; 18 | my $fetch_RNG = sub { # Lazily, instantiate the RNG object, but only once. 19 | $RNG_object = Crypt::PRNG::RC4->new unless defined $RNG_object && ref($RNG_object) ne 'SCALAR'; 20 | return $RNG_object; 21 | }; 22 | sub rand { return $fetch_RNG->()->double(@_) } 23 | sub irand { return $fetch_RNG->()->int32(@_) } 24 | sub random_bytes { return $fetch_RNG->()->bytes(@_) } 25 | sub random_bytes_hex { return $fetch_RNG->()->bytes_hex(@_) } 26 | sub random_bytes_b64 { return $fetch_RNG->()->bytes_b64(@_) } 27 | sub random_bytes_b64u { return $fetch_RNG->()->bytes_b64u(@_) } 28 | sub random_string_from { return $fetch_RNG->()->string_from(@_) } 29 | sub random_string { return $fetch_RNG->()->string(@_) } 30 | } 31 | 32 | 33 | 1; 34 | 35 | =pod 36 | 37 | =head1 NAME 38 | 39 | Crypt::PRNG::RC4 - Cryptographically secure PRNG based on RC4 (stream cipher) algorithm 40 | 41 | =head1 SYNOPSIS 42 | 43 | ### Functional interface: 44 | use Crypt::PRNG::RC4 qw(random_bytes random_bytes_hex random_bytes_b64 random_string random_string_from rand irand); 45 | 46 | $octets = random_bytes(45); 47 | $hex_string = random_bytes_hex(45); 48 | $base64_string = random_bytes_b64(45); 49 | $base64url_string = random_bytes_b64u(45); 50 | $alphanumeric_string = random_string(30); 51 | $string = random_string_from('ACGT', 64); 52 | $floating_point_number_0_to_1 = rand; 53 | $floating_point_number_0_to_88 = rand(88); 54 | $unsigned_32bit_int = irand; 55 | 56 | ### OO interface: 57 | use Crypt::PRNG::RC4; 58 | 59 | $prng = Crypt::PRNG::RC4->new; 60 | #or 61 | $prng = Crypt::PRNG::RC4->new("some data used for seeding PRNG"); 62 | 63 | $octets = $prng->bytes(45); 64 | $hex_string = $prng->bytes_hex(45); 65 | $base64_string = $prng->bytes_b64(45); 66 | $base64url_string = $prng->bytes_b64u(45); 67 | $alphanumeric_string = $prng->string(30); 68 | $string = $prng->string_from('ACGT', 64); 69 | $floating_point_number_0_to_1 = rand; 70 | $floating_point_number_0_to_88 = rand(88); 71 | $unsigned_32bit_int = irand; 72 | 73 | =head1 DESCRIPTION 74 | 75 | Provides an interface to the RC4 based pseudo random number generator 76 | 77 | All methods and functions are the same as for L. 78 | 79 | =head1 FUNCTIONS 80 | 81 | =head2 random_bytes 82 | 83 | See L. 84 | 85 | =head2 random_bytes_hex 86 | 87 | See L. 88 | 89 | =head2 random_bytes_b64 90 | 91 | See L. 92 | 93 | =head2 random_bytes_b64u 94 | 95 | See L. 96 | 97 | =head2 random_string 98 | 99 | See L. 100 | 101 | =head2 random_string_from 102 | 103 | See L. 104 | 105 | =head2 rand 106 | 107 | See L. 108 | 109 | =head2 irand 110 | 111 | See L. 112 | 113 | =head1 METHODS 114 | 115 | =head2 new 116 | 117 | See L. 118 | 119 | =head2 bytes 120 | 121 | See L. 122 | 123 | =head2 bytes_hex 124 | 125 | See L. 126 | 127 | =head2 bytes_b64 128 | 129 | See L. 130 | 131 | =head2 bytes_b64u 132 | 133 | See L. 134 | 135 | =head2 string 136 | 137 | See L. 138 | 139 | =head2 string_from 140 | 141 | See L. 142 | 143 | =head2 double 144 | 145 | See L. 146 | 147 | =head2 int32 148 | 149 | See L. 150 | 151 | =head1 SEE ALSO 152 | 153 | =over 154 | 155 | =item * L 156 | 157 | =item * L 158 | 159 | =back 160 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/PRNG/Sober128.pm: -------------------------------------------------------------------------------- 1 | package Crypt::PRNG::Sober128; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use base qw(Crypt::PRNG Exporter); 8 | our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] ); 9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 10 | our @EXPORT = qw(); 11 | 12 | use CryptX; 13 | use base 'Crypt::PRNG'; 14 | 15 | { 16 | ### stolen from Bytes::Random::Secure 17 | my $RNG_object = undef; 18 | my $fetch_RNG = sub { # Lazily, instantiate the RNG object, but only once. 19 | $RNG_object = Crypt::PRNG::Sober128->new unless defined $RNG_object && ref($RNG_object) ne 'SCALAR'; 20 | return $RNG_object; 21 | }; 22 | sub rand { return $fetch_RNG->()->double(@_) } 23 | sub irand { return $fetch_RNG->()->int32(@_) } 24 | sub random_bytes { return $fetch_RNG->()->bytes(@_) } 25 | sub random_bytes_hex { return $fetch_RNG->()->bytes_hex(@_) } 26 | sub random_bytes_b64 { return $fetch_RNG->()->bytes_b64(@_) } 27 | sub random_bytes_b64u { return $fetch_RNG->()->bytes_b64u(@_) } 28 | sub random_string_from { return $fetch_RNG->()->string_from(@_) } 29 | sub random_string { return $fetch_RNG->()->string(@_) } 30 | } 31 | 32 | 33 | 1; 34 | 35 | =pod 36 | 37 | =head1 NAME 38 | 39 | Crypt::PRNG::Sober128 - Cryptographically secure PRNG based on Sober128 (stream cipher) algorithm 40 | 41 | =head1 SYNOPSIS 42 | 43 | ### Functional interface: 44 | use Crypt::PRNG::Sober128 qw(random_bytes random_bytes_hex random_bytes_b64 random_string random_string_from rand irand); 45 | 46 | $octets = random_bytes(45); 47 | $hex_string = random_bytes_hex(45); 48 | $base64_string = random_bytes_b64(45); 49 | $base64url_string = random_bytes_b64u(45); 50 | $alphanumeric_string = random_string(30); 51 | $string = random_string_from('ACGT', 64); 52 | $floating_point_number_0_to_1 = rand; 53 | $floating_point_number_0_to_88 = rand(88); 54 | $unsigned_32bit_int = irand; 55 | 56 | ### OO interface: 57 | use Crypt::PRNG::Sober128; 58 | 59 | $prng = Crypt::PRNG::Sober128->new; 60 | #or 61 | $prng = Crypt::PRNG::Sober128->new("some data used for seeding PRNG"); 62 | 63 | $octets = $prng->bytes(45); 64 | $hex_string = $prng->bytes_hex(45); 65 | $base64_string = $prng->bytes_b64(45); 66 | $base64url_string = $prng->bytes_b64u(45); 67 | $alphanumeric_string = $prng->string(30); 68 | $string = $prng->string_from('ACGT', 64); 69 | $floating_point_number_0_to_1 = rand; 70 | $floating_point_number_0_to_88 = rand(88); 71 | $unsigned_32bit_int = irand; 72 | 73 | =head1 DESCRIPTION 74 | 75 | Provides an interface to the Sober128 based pseudo random number generator 76 | 77 | All methods and functions are the same as for L. 78 | 79 | =head1 FUNCTIONS 80 | 81 | =head2 random_bytes 82 | 83 | See L. 84 | 85 | =head2 random_bytes_hex 86 | 87 | See L. 88 | 89 | =head2 random_bytes_b64 90 | 91 | See L. 92 | 93 | =head2 random_bytes_b64u 94 | 95 | See L. 96 | 97 | =head2 random_string 98 | 99 | See L. 100 | 101 | =head2 random_string_from 102 | 103 | See L. 104 | 105 | =head2 rand 106 | 107 | See L. 108 | 109 | =head2 irand 110 | 111 | See L. 112 | 113 | =head1 METHODS 114 | 115 | =head2 new 116 | 117 | See L. 118 | 119 | =head2 bytes 120 | 121 | See L. 122 | 123 | =head2 bytes_hex 124 | 125 | See L. 126 | 127 | =head2 bytes_b64 128 | 129 | See L. 130 | 131 | =head2 bytes_b64u 132 | 133 | See L. 134 | 135 | =head2 string 136 | 137 | See L. 138 | 139 | =head2 string_from 140 | 141 | See L. 142 | 143 | =head2 double 144 | 145 | See L. 146 | 147 | =head2 int32 148 | 149 | See L. 150 | 151 | =head1 SEE ALSO 152 | 153 | =over 154 | 155 | =item * L 156 | 157 | =item * L 158 | 159 | =back 160 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/PRNG/Yarrow.pm: -------------------------------------------------------------------------------- 1 | package Crypt::PRNG::Yarrow; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use base qw(Crypt::PRNG Exporter); 8 | our %EXPORT_TAGS = ( all => [qw(random_bytes random_bytes_hex random_bytes_b64 random_bytes_b64u random_string random_string_from rand irand)] ); 9 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); 10 | our @EXPORT = qw(); 11 | 12 | use CryptX; 13 | 14 | { 15 | ### stolen from Bytes::Random::Secure 16 | my $RNG_object = undef; 17 | my $fetch_RNG = sub { # Lazily, instantiate the RNG object, but only once. 18 | $RNG_object = Crypt::PRNG::Yarrow->new unless defined $RNG_object && ref($RNG_object) ne 'SCALAR'; 19 | return $RNG_object; 20 | }; 21 | sub rand { return $fetch_RNG->()->double(@_) } 22 | sub irand { return $fetch_RNG->()->int32(@_) } 23 | sub random_bytes { return $fetch_RNG->()->bytes(@_) } 24 | sub random_bytes_hex { return $fetch_RNG->()->bytes_hex(@_) } 25 | sub random_bytes_b64 { return $fetch_RNG->()->bytes_b64(@_) } 26 | sub random_bytes_b64u { return $fetch_RNG->()->bytes_b64u(@_) } 27 | sub random_string_from { return $fetch_RNG->()->string_from(@_) } 28 | sub random_string { return $fetch_RNG->()->string(@_) } 29 | } 30 | 31 | 32 | 1; 33 | 34 | =pod 35 | 36 | =head1 NAME 37 | 38 | Crypt::PRNG::Yarrow - Cryptographically secure PRNG based on Yarrow algorithm 39 | 40 | =head1 SYNOPSIS 41 | 42 | ### Functional interface: 43 | use Crypt::PRNG::Yarrow qw(random_bytes random_bytes_hex random_bytes_b64 random_string random_string_from rand irand); 44 | 45 | $octets = random_bytes(45); 46 | $hex_string = random_bytes_hex(45); 47 | $base64_string = random_bytes_b64(45); 48 | $base64url_string = random_bytes_b64u(45); 49 | $alphanumeric_string = random_string(30); 50 | $string = random_string_from('ACGT', 64); 51 | $floating_point_number_0_to_1 = rand; 52 | $floating_point_number_0_to_88 = rand(88); 53 | $unsigned_32bit_int = irand; 54 | 55 | ### OO interface: 56 | use Crypt::PRNG::Yarrow; 57 | 58 | $prng = Crypt::PRNG::Yarrow->new; 59 | #or 60 | $prng = Crypt::PRNG::Yarrow->new("some data used for seeding PRNG"); 61 | 62 | $octets = $prng->bytes(45); 63 | $hex_string = $prng->bytes_hex(45); 64 | $base64_string = $prng->bytes_b64(45); 65 | $base64url_string = $prng->bytes_b64u(45); 66 | $alphanumeric_string = $prng->string(30); 67 | $string = $prng->string_from('ACGT', 64); 68 | $floating_point_number_0_to_1 = rand; 69 | $floating_point_number_0_to_88 = rand(88); 70 | $unsigned_32bit_int = irand; 71 | 72 | =head1 DESCRIPTION 73 | 74 | Provides an interface to the Yarrow based pseudo random number generator 75 | 76 | All methods and functions are the same as for L. 77 | 78 | =head1 FUNCTIONS 79 | 80 | =head2 random_bytes 81 | 82 | See L. 83 | 84 | =head2 random_bytes_hex 85 | 86 | See L. 87 | 88 | =head2 random_bytes_b64 89 | 90 | See L. 91 | 92 | =head2 random_bytes_b64u 93 | 94 | See L. 95 | 96 | =head2 random_string 97 | 98 | See L. 99 | 100 | =head2 random_string_from 101 | 102 | See L. 103 | 104 | =head2 rand 105 | 106 | See L. 107 | 108 | =head2 irand 109 | 110 | See L. 111 | 112 | =head1 METHODS 113 | 114 | =head2 new 115 | 116 | See L. 117 | 118 | =head2 bytes 119 | 120 | See L. 121 | 122 | =head2 bytes_hex 123 | 124 | See L. 125 | 126 | =head2 bytes_b64 127 | 128 | See L. 129 | 130 | =head2 bytes_b64u 131 | 132 | See L. 133 | 134 | =head2 string 135 | 136 | See L. 137 | 138 | =head2 string_from 139 | 140 | See L. 141 | 142 | =head2 double 143 | 144 | See L. 145 | 146 | =head2 int32 147 | 148 | See L. 149 | 150 | =head1 SEE ALSO 151 | 152 | =over 153 | 154 | =item * L 155 | 156 | =item * L 157 | 158 | =back 159 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/Stream/ChaCha.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Stream::ChaCha; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use CryptX; 8 | 9 | sub new { my $class = shift; _new(@_) } 10 | 11 | 1; 12 | 13 | =pod 14 | 15 | =head1 NAME 16 | 17 | Crypt::Stream::ChaCha - Stream cipher ChaCha 18 | 19 | =head1 SYNOPSIS 20 | 21 | use Crypt::Stream::ChaCha; 22 | 23 | # encrypt 24 | $key = "1234567890123456"; 25 | $iv = "123456789012"; 26 | $stream = Crypt::Stream::ChaCha->new($key, $iv); 27 | $ct = $stream->crypt("plain message"); 28 | 29 | # decrypt 30 | $key = "1234567890123456"; 31 | $iv = "123456789012"; 32 | $stream = Crypt::Stream::ChaCha->new($key, $iv); 33 | $pt = $stream->crypt($ct); 34 | 35 | =head1 DESCRIPTION 36 | 37 | Provides an interface to the ChaCha stream cipher. 38 | 39 | =head1 METHODS 40 | 41 | =head2 new 42 | 43 | $stream = Crypt::Stream::ChaCha->new($key, $iv); 44 | #or 45 | $stream = Crypt::Stream::ChaCha->new($key, $iv, $counter, $rounds); 46 | 47 | # $key .. 32 or 16 bytes 48 | # $iv .. 8 or 12 bytes 49 | # $counter .. initial counter value (DEFAULT: 0) 50 | # $rounds .. rounds (DEFAULT: 20) 51 | 52 | =head2 crypt 53 | 54 | $ciphertext = $stream->crypt($plaintext); 55 | #or 56 | $plaintext = $stream->crypt($ciphertext); 57 | 58 | =head2 keystream 59 | 60 | $random_key = $stream->keystream($length); 61 | 62 | =head2 clone 63 | 64 | $stream->clone(); 65 | 66 | =head1 SEE ALSO 67 | 68 | =over 69 | 70 | =item * L, L 71 | 72 | =item * L 73 | 74 | =back 75 | 76 | =cut 77 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/Stream/RC4.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Stream::RC4; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use CryptX; 8 | 9 | sub new { my $class = shift; _new(@_) } 10 | 11 | 1; 12 | 13 | =pod 14 | 15 | =head1 NAME 16 | 17 | Crypt::Stream::RC4 - Stream cipher RC4 18 | 19 | =head1 SYNOPSIS 20 | 21 | use Crypt::Stream::RC4; 22 | 23 | # encrypt 24 | $key = "1234567890123456"; 25 | $stream = Crypt::Stream::RC4->new($key); 26 | $ct = $stream->crypt("plain message"); 27 | 28 | # decrypt 29 | $key = "1234567890123456"; 30 | $stream = Crypt::Stream::RC4->new($key); 31 | $pt = $stream->crypt($ct); 32 | 33 | =head1 DESCRIPTION 34 | 35 | Provides an interface to the RC4 stream cipher. 36 | 37 | =head1 METHODS 38 | 39 | =head2 new 40 | 41 | $stream = Crypt::Stream::RC4->new($key); 42 | # $key .. length 5-256 bytes (40 - 2048 bits) 43 | 44 | =head2 crypt 45 | 46 | $ciphertext = $stream->crypt($plaintext); 47 | #or 48 | $plaintext = $stream->crypt($ciphertext); 49 | 50 | =head2 keystream 51 | 52 | $random_key = $stream->keystream($length); 53 | 54 | =head2 clone 55 | 56 | $stream->clone(); 57 | 58 | =head1 SEE ALSO 59 | 60 | =over 61 | 62 | =item * L, L 63 | 64 | =item * L 65 | 66 | =back 67 | 68 | =cut 69 | -------------------------------------------------------------------------------- /pairing/lib/Crypt/Stream/Sober128.pm: -------------------------------------------------------------------------------- 1 | package Crypt::Stream::Sober128; 2 | 3 | use strict; 4 | use warnings; 5 | our $VERSION = '0.048'; 6 | 7 | use CryptX; 8 | 9 | sub new { my $class = shift; _new(@_) } 10 | 11 | 1; 12 | 13 | =pod 14 | 15 | =head1 NAME 16 | 17 | Crypt::Stream::Sober128 - Stream cipher Sober128 18 | 19 | =head1 SYNOPSIS 20 | 21 | use Crypt::Stream::Sober128; 22 | 23 | # encrypt 24 | $key = "1234567890123456"; 25 | $iv = "123456789012"; 26 | $stream = Crypt::Stream::Sober128->new($key, $iv); 27 | $ct = $stream->crypt("plain message"); 28 | 29 | # decrypt 30 | $key = "1234567890123456"; 31 | $iv = "123456789012"; 32 | $stream = Crypt::Stream::Sober128->new($key, $iv); 33 | $pt = $stream->crypt($ct); 34 | 35 | =head1 DESCRIPTION 36 | 37 | Provides an interface to the Sober128 stream cipher. 38 | 39 | =head1 METHODS 40 | 41 | =head2 new 42 | 43 | $stream = Crypt::Stream::Sober128->new($key, $iv); 44 | # $key .. keylen must be multiple of 4 bytes 45 | # $iv .. ivlen must be multiple of 4 bytes 46 | 47 | =head2 crypt 48 | 49 | $ciphertext = $stream->crypt($plaintext); 50 | #or 51 | $plaintext = $stream->crypt($ciphertext); 52 | 53 | =head2 keystream 54 | 55 | $random_key = $stream->keystream($length); 56 | 57 | =head2 clone 58 | 59 | $stream->clone(); 60 | 61 | =head1 SEE ALSO 62 | 63 | =over 64 | 65 | =item * L, L 66 | 67 | =item * L 68 | 69 | =back 70 | 71 | =cut 72 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/LibraryToDo.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::LibraryToDo; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::ToDo Class::Accessor/; 7 | 8 | my %mapping = ( 9 | alarms => "ToDo Alarms", 10 | cal_id => "ToDo Calendar ID", 11 | calendar => "ToDo Calendar Title", 12 | complete => "ToDo Completed", 13 | completed_at => "ToDo Date Completed", 14 | created => "ToDo Date Created", 15 | due => "ToDo Due Date", 16 | notes => "ToDo Notes", 17 | priority => "ToDo Priority", 18 | title => "ToDo Title", 19 | url => "ToDo URL", 20 | id => "ToDo iCal ID", 21 | keys_digest => "ToDo Keys Digest", 22 | ); 23 | 24 | my %lookup = ( reverse %mapping ); 25 | 26 | sub init { 27 | my $self = shift; 28 | 29 | __PACKAGE__->mk_accessors( grep { not $self->can($_) } keys %mapping ); 30 | $self->{ $lookup{$_} } = delete $self->{$_} 31 | for grep { exists $lookup{$_} } keys %{$self}; 32 | 33 | $self->due(undef) unless delete $self->{"ToDo Due Date Enabled"}; 34 | $self->priority(undef) unless delete $self->{"ToDo Priority Enabled"}; 35 | } 36 | 37 | sub serialize_equiv { 38 | my $self = shift; 39 | my $hash = {}; 40 | $hash->{ $mapping{$_} } = $self->{$_} for keys %{$self}; 41 | return $hash; 42 | } 43 | 44 | sub serialize { 45 | my $self = shift; 46 | my $ret = $self->SUPER::serialize; 47 | $ret->[1]{"ToDo Completed"} 48 | = $self->{complete} ? [ true => 1 ] : [ false => 0 ]; 49 | if ( $self->{due} ) { 50 | $ret->[1]{"ToDo Due Date Enabled"} = [ true => 1 ]; 51 | } else { 52 | delete $ret->[1]{"ToDo Due Date"}; 53 | $ret->[1]{"ToDo Due Date Enabled"} = [ false => 0 ]; 54 | } 55 | 56 | if ( defined $self->{priority} ) { 57 | $ret->[1]{"ToDo Priority Enabled"} = [ true => 1 ]; 58 | } else { 59 | $ret->[1]{"ToDo Priority"} = [ integer => 1 ]; 60 | $ret->[1]{"ToDo Priority Enabled"} = [ false => 0 ]; 61 | } 62 | 63 | return $ret; 64 | } 65 | 66 | 1; 67 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/NSArray.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::NSArray; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSObject/; 7 | 8 | 1; 9 | 10 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/NSData.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::NSData; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSObject/; 7 | 8 | 1; 9 | 10 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/NSMutableArray.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::NSMutableArray; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSArray/; 7 | 8 | sub serialize { 9 | my $self = shift; 10 | my $ret = $self->SUPER::serialize; 11 | $ret->[1]{'NS.objects'} 12 | = [ 13 | array => [ map { [ UID => $_ ] } @{ $ret->[1]{'NS.objects'}[1][1] } ] 14 | ]; 15 | return $ret; 16 | } 17 | 18 | 1; 19 | 20 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/NSMutableData.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::NSMutableData; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSData/; 7 | use Data::Plist::BinaryWriter; 8 | 9 | sub data { 10 | my $self = shift; 11 | return $self->{"NS.data"}; 12 | } 13 | 14 | sub serialize_equiv { 15 | my $self = shift; 16 | return $self->SUPER::serialize_equiv unless ref $self->data; 17 | return { "NS.data" => Data::Plist::BinaryWriter->write( $self->data ) }; 18 | } 19 | 20 | 1; 21 | 22 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/NSMutableString.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::NSMutableString; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSString/; 7 | 8 | sub replacement { 9 | my $self = shift; 10 | return $self->{"NS.string"}; 11 | } 12 | 13 | 1; 14 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/NSObject.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::NSObject; 2 | 3 | use strict; 4 | use warnings; 5 | use Class::ISA; 6 | use UNIVERSAL::isa; 7 | use Scalar::Util qw//; 8 | 9 | sub init { 10 | my $self = shift; 11 | } 12 | 13 | sub replacement { 14 | my $self = shift; 15 | $self->init; 16 | return $self; 17 | } 18 | 19 | sub serialize_class { 20 | my $self = shift; 21 | $self = ref $self if ref $self; 22 | 23 | my $short = $self; 24 | $short =~ s/^Data::Plist::Foundation:://; 25 | return [ 26 | UID => [ 27 | dict => { 28 | '$classes' => [ 29 | array => [ 30 | map { s/^Data::Plist::Foundation:://; [ string => $_ ] } 31 | grep { $_->isa("Data::Plist::Foundation::NSObject") } 32 | Class::ISA::self_and_super_path($self) 33 | ] 34 | ], 35 | '$classname' => [ string => $short ], 36 | } 37 | ] 38 | ]; 39 | } 40 | 41 | sub serialize_equiv { 42 | my $self = shift; 43 | return { %{$self} }; 44 | } 45 | 46 | sub serialize { 47 | my $self = shift; 48 | my %dict; 49 | $dict{'$class'} = $self->serialize_class; 50 | my $equiv = $self->serialize_equiv; 51 | for my $key ( keys %{$equiv} ) { 52 | my $value = Data::Plist::Writer->serialize_value( $equiv->{$key} ); 53 | if ( $value->[0] =~ /^(data|integer|real|true|false)$/ ) { 54 | $dict{$key} = $value; 55 | } else { 56 | $dict{$key} = [ UID => $value ]; 57 | } 58 | } 59 | return [ dict => \%dict ]; 60 | } 61 | 62 | 1; 63 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/NSString.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::NSString; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSObject/; 7 | 8 | 1; 9 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/NSURL.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::NSURL; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSObject URI::http/; 7 | 8 | sub replacement { 9 | my $self = shift; 10 | my $uri = URI->new( $self->{"NS.relative"}, "http" ); 11 | bless $uri, ( ref $self ); 12 | return $uri; 13 | } 14 | 15 | sub serialize_equiv { 16 | my $self = shift; 17 | return { "NS.relative" => $self->as_string, "NS.base" => undef }; 18 | } 19 | 20 | 1; 21 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/ToDo.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::ToDo; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSObject/; 7 | 8 | 1; 9 | 10 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/ToDoAlarm.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::ToDoAlarm; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSObject/; 7 | 8 | sub serialize { 9 | my $self = shift; 10 | my $ret = $self->SUPER::serialize; 11 | $ret->[1]{"ToDo Alarm Enabled"} 12 | = $ret->[1]{"ToDo Alarm Enabled"}[1] ? [ true => 1 ] : [ false => 0 ]; 13 | return $ret; 14 | } 15 | 16 | 1; 17 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Foundation/ToDoAlarms.pm: -------------------------------------------------------------------------------- 1 | package Data::Plist::Foundation::ToDoAlarms; 2 | 3 | use strict; 4 | use warnings; 5 | 6 | use base qw/Data::Plist::Foundation::NSObject/; 7 | 8 | 1; 9 | 10 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/Reader.pm: -------------------------------------------------------------------------------- 1 | =head1 NAME 2 | 3 | Data::Plist::Reader - Abstract superclass for BinaryReader 4 | 5 | =head1 SYNOPSIS 6 | 7 | # Create new 8 | $read = Data::Plist::BinaryReader->new; 9 | 10 | # Reading from a string C<$str> 11 | my $plist = $read->open_string($str); 12 | 13 | # Writing from file C<$filename> 14 | $plist = $read->read($filename); 15 | 16 | =head1 DESCRIPTION 17 | 18 | C is an abstract superclass of 19 | BinaryReader. Takes either a string or a filehandle containing data 20 | formatted as an Apple property list and returns it as a 21 | C. 22 | 23 | =cut 24 | 25 | package Data::Plist::Reader; 26 | 27 | use strict; 28 | use warnings; 29 | 30 | =head1 METHODS 31 | 32 | =head2 new 33 | 34 | Create a new reader. 35 | 36 | =cut 37 | 38 | sub new { 39 | my $class = shift; 40 | return bless {} => $class; 41 | } 42 | 43 | =head2 open_string $content 44 | 45 | Takes binary data C<$content> and reads it into a 46 | filehandle. Then passes that filehandle to L. 47 | 48 | =cut 49 | 50 | sub open_string { 51 | my $self = shift; 52 | my ($content) = @_; 53 | 54 | my $fh; 55 | open( $fh, "<", \$content ); 56 | 57 | return $self->open_fh($fh); 58 | } 59 | 60 | =head2 open_file $filename 61 | 62 | Takes a filename C<$filename> and reads its data into a 63 | filehandle. Then passes the filehandle to L. 64 | 65 | =cut 66 | 67 | sub open_file { 68 | my $self = shift; 69 | my ($filename) = @_; 70 | 71 | my $fh; 72 | open( $fh, "<", $filename ) or die "can't open $filename for conversion"; 73 | binmode($fh); 74 | return $self->open_fh($fh); 75 | } 76 | 77 | =head2 open_fh 78 | 79 | Place-holder method for Reader's subclass. Currently 80 | unimplemented. 81 | 82 | =cut 83 | 84 | sub open_fh { 85 | my $self = shift; 86 | 87 | die "Unimplemented!"; 88 | } 89 | 90 | 1; 91 | -------------------------------------------------------------------------------- /pairing/lib/Data/Plist/XMLWriter.pm: -------------------------------------------------------------------------------- 1 | =head1 NAME 2 | 3 | Data::Plist::XMLWriter - writes XML property lists from 4 | perl data structures. 5 | 6 | =head1 SYNOPSIS 7 | 8 | # Create new 9 | my $write = Data::Plist::XMLWriter->new; 10 | 11 | # Writing to a string 12 | my $str = $write->write($data); 13 | 14 | # Writing to a file C<$filename> 15 | $write->write($filename, $data); 16 | 17 | =head1 DESCRIPTION 18 | 19 | C takes perl data structures, 20 | serializes them (see L) and 21 | recursively writes to a given filehandle in Apple's XML 22 | property list format. 23 | 24 | =cut 25 | 26 | package Data::Plist::XMLWriter; 27 | 28 | use strict; 29 | use warnings; 30 | 31 | use base qw/Data::Plist::Writer/; 32 | use XML::Writer; 33 | use MIME::Base64 qw//; 34 | 35 | =head2 write_fh $fh, $data 36 | 37 | Takes a perl data structure C<$data>, serializes it (see 38 | L) and passes it to 39 | L to be written to the filehandle C<$fh>. Also 40 | writes the headers and footers for the XML document. Returns 41 | 1 to indicate success. 42 | 43 | =cut 44 | 45 | sub write_fh { 46 | my $self = shift; 47 | $self = $self->new() unless ref $self; 48 | 49 | my ( $fh, $object ) = @_; 50 | local $self->{x} 51 | = XML::Writer->new( OUTPUT => $fh, DATA_MODE => 1, DATA_INDENT => 8 ); 52 | $self->{x}->xmlDecl("UTF-8"); 53 | $self->{x}->doctype( 54 | "plist", 55 | "-//Apple//DTD PLIST 1.0//EN", 56 | "http://www.apple.com/DTDs/PropertyList-1.0.dtd" 57 | ); 58 | $self->{x}->startTag( plist => version => "1.0" ); 59 | $object = $self->serialize($object) if ( $self->{serialize} ); 60 | $self->xml_write($object); 61 | $self->{x}->endTag("plist"); 62 | $self->{x}->end(); 63 | 64 | return 1; 65 | } 66 | 67 | =head2 xml_write 68 | 69 | Takes serialized perl structures (see 70 | L) and recursively checks tags 71 | and writes the data to the filehandle. 72 | 73 | =cut 74 | 75 | sub xml_write { 76 | my $self = shift; 77 | my $data = shift; 78 | 79 | if ( $data->[0] =~ /^(true|false|fill|null)$/ ) { 80 | $self->{x}->emptyTag( $data->[0] ); 81 | } elsif ( $data->[0] =~ /^(integer|real|date|string|ustring)$/ ) { 82 | $self->{x}->dataElement( $data->[0], $data->[1] ); 83 | } elsif ( $data->[0] eq "UID" ) { 84 | 85 | # UIDs are only hackishly supported in the XML version. 86 | # Apple's plutil converts them as follows: 87 | $self->{x}->startTag("dict"); 88 | $self->{x}->dataElement( "key", 'CF$UID' ); 89 | $self->{x}->dataElement( "integer", $data->[1] ); 90 | $self->{x}->endTag("dict"); 91 | } elsif ( $data->[0] eq "data" ) { 92 | $self->{x}->dataElement( "data", 93 | MIME::Base64::encode_base64( $data->[1] ) ); 94 | } elsif ( $data->[0] eq "dict" ) { 95 | $self->{x}->startTag("dict"); 96 | for my $k ( sort keys %{ $data->[1] } ) { 97 | $self->{x}->dataElement( "key", $k ); 98 | $self->xml_write( $data->[1]{$k} ); 99 | } 100 | $self->{x}->endTag("dict"); 101 | } elsif ( $data->[0] eq "array" ) { 102 | $self->{x}->startTag("array"); 103 | $self->xml_write($_) for @{ $data->[1] }; 104 | $self->{x}->endTag("array"); 105 | } else { 106 | $self->{x}->comment( $data->[0] ); 107 | } 108 | } 109 | 110 | 1; 111 | -------------------------------------------------------------------------------- /src/aes.h: -------------------------------------------------------------------------------- 1 | #ifndef _AES_H 2 | #define _AES_H 3 | 4 | #include 5 | 6 | typedef struct 7 | { 8 | uint32_t erk[64]; /* encryption round keys */ 9 | uint32_t drk[64]; /* decryption round keys */ 10 | int nr; /* number of rounds */ 11 | } 12 | aes_context; 13 | 14 | int aes_set_key( aes_context *ctx, uint8_t *key, int nbits ); 15 | void aes_encrypt( aes_context *ctx, uint8_t input[16], uint8_t output[16] ); 16 | void aes_decrypt( aes_context *ctx, uint8_t input[16], uint8_t output[16] ); 17 | 18 | #endif /* aes.h */ 19 | -------------------------------------------------------------------------------- /src/aes_ctr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Byte-oriented AES-256 implementation. 3 | * All lookup tables replaced with 'on the fly' calculations. 4 | * 5 | * Copyright (c) 2007-2009 Ilya O. Levin, http://www.literatecode.com 6 | * Other contributors: Hal Finney 7 | * AES128 support (c) 2013 Paul Sokolovsky 8 | * 9 | * Permission to use, copy, modify, and distribute this software for any 10 | * purpose with or without fee is hereby granted, provided that the above 11 | * copyright notice and this permission notice appear in all copies. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | */ 21 | #include "aes_ctr.h" 22 | 23 | 24 | /* -------------------------------------------------------------------------- */ 25 | void aes_ctr_init(aes_ctr_context *ctx, uint8_t *key, uint8_t *iblk, uint8_t mode) 26 | { 27 | uint8_t i, *p = (uint8_t *) &ctx->blk; 28 | 29 | if (!ctx)return; 30 | 31 | aes_set_key(&ctx->aes_ctx, key, 128); 32 | ctx->mode = mode; 33 | 34 | if (!iblk) return; 35 | 36 | for (i = 0; i < sizeof(ctx->blk); i++) p[i] = iblk[i]; 37 | } 38 | 39 | /* -------------------------------------------------------------------------- */ 40 | static void ctr_inc_ctr(union ctr_blk_s *blk, int mode) 41 | { 42 | int i, len; 43 | uint8_t *val; 44 | 45 | if (mode & 0x10) { 46 | val = blk->rfc3686.ctr; 47 | len = 4; 48 | } else { 49 | val = blk->ctr; 50 | len = 16; 51 | } 52 | 53 | if ((mode & 0x01) == CTR_LITTLE_ENDIAN) { 54 | for (i = 0; i < len; i++) if (++(val[i]) != 0) break; 55 | } else { 56 | for (i = len-1; i >= 0; i--) if (++(val[i]) != 0) break; 57 | } 58 | 59 | return; 60 | } 61 | 62 | /* -------------------------------------------------------------------------- */ 63 | static void ctr_clock_keystream(aes_ctr_context *ctx, uint8_t *ks) 64 | { 65 | uint8_t i; 66 | uint8_t *p = (uint8_t *) &ctx->blk; 67 | 68 | for (i = 0; i < sizeof(ctx->blk); i++) ks[i] = p[i]; 69 | 70 | aes_encrypt(&ctx->aes_ctx, ks, ks); 71 | ctr_inc_ctr(&ctx->blk, ctx->mode); 72 | } 73 | 74 | /* -------------------------------------------------------------------------- */ 75 | void aes_ctr_encrypt(aes_ctr_context *ctx, uint8_t *data, size_t sz) 76 | { 77 | uint8_t key[sizeof(ctx->blk)]; 78 | size_t i; 79 | uint8_t j = sizeof(key); 80 | 81 | for (i = 0; i < sz; i++) { 82 | if ( j == sizeof(key) ) { 83 | j = 0; 84 | ctr_clock_keystream(ctx, key); 85 | } 86 | data[i] ^= key[j++]; 87 | } 88 | 89 | } /* aes256_encrypt_ctr */ 90 | -------------------------------------------------------------------------------- /src/aes_ctr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Byte-oriented AES-256 implementation. 3 | * All lookup tables replaced with 'on the fly' calculations. 4 | * 5 | * Copyright (c) 2007-2009 Ilya O. Levin, http://www.literatecode.com 6 | * Other contributors: Hal Finney 7 | * AES128 support (c) 2013 Paul Sokolovsky 8 | * 9 | * Permission to use, copy, modify, and distribute this software for any 10 | * purpose with or without fee is hereby granted, provided that the above 11 | * copyright notice and this permission notice appear in all copies. 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | */ 21 | #ifndef uint8_t 22 | #include 23 | #endif 24 | #ifndef size_t 25 | #include 26 | #endif 27 | 28 | #include "aes.h" 29 | 30 | #define CTR_LITTLE_ENDIAN 0x00 31 | #define CTR_BIG_ENDIAN 0x01 32 | #define CTR_RFC3686_LITTLE_ENDIAN 0x10 33 | #define CTR_RFC3686_BIG_ENDIAN 0x11 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | typedef struct { 40 | union ctr_blk_s { 41 | uint8_t ctr[16]; 42 | struct { 43 | uint8_t nonce[4]; 44 | uint8_t iv[8]; 45 | uint8_t ctr[4]; 46 | } rfc3686; 47 | } blk; 48 | int mode; 49 | aes_context aes_ctx; 50 | } aes_ctr_context; 51 | 52 | 53 | void aes_ctr_init(aes_ctr_context *ctx, uint8_t *key, uint8_t *iv, uint8_t mode); 54 | void aes_ctr_encrypt(aes_ctr_context *ctx, uint8_t *data, size_t sz); 55 | #define aes_ctr_decrypt(ctx, data, sz) aes_ctr_encrypt(ctx, data, sz); 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | -------------------------------------------------------------------------------- /src/alac.h: -------------------------------------------------------------------------------- 1 | #ifndef __ALAC__DECOMP_H 2 | #define __ALAC__DECOMP_H 3 | 4 | typedef struct alac_file alac_file; 5 | 6 | alac_file *create_alac(int samplesize, int numchannels); 7 | void delete_alac(alac_file *alac); 8 | void decode_frame(alac_file *alac, 9 | unsigned char *inbuffer, 10 | void *outbuffer, int *outputsize); 11 | void alac_set_info(alac_file *alac, char *inputbuffer); 12 | void allocate_buffers(alac_file *alac); 13 | 14 | struct alac_file 15 | { 16 | unsigned char *input_buffer; 17 | int input_buffer_bitaccumulator; /* used so we can do arbitary 18 | bit reads */ 19 | 20 | int samplesize; 21 | int numchannels; 22 | int bytespersample; 23 | 24 | 25 | /* buffers */ 26 | int32_t *predicterror_buffer_a; 27 | int32_t *predicterror_buffer_b; 28 | 29 | int32_t *outputsamples_buffer_a; 30 | int32_t *outputsamples_buffer_b; 31 | 32 | int32_t *uncompressed_bytes_buffer_a; 33 | int32_t *uncompressed_bytes_buffer_b; 34 | 35 | 36 | 37 | /* stuff from setinfo */ 38 | uint32_t setinfo_max_samples_per_frame; /* 0x1000 = 4096 */ /* max samples per frame? */ 39 | uint8_t setinfo_7a; /* 0x00 */ 40 | uint8_t setinfo_sample_size; /* 0x10 */ 41 | uint8_t setinfo_rice_historymult; /* 0x28 */ 42 | uint8_t setinfo_rice_initialhistory; /* 0x0a */ 43 | uint8_t setinfo_rice_kmodifier; /* 0x0e */ 44 | uint8_t setinfo_7f; /* 0x02 */ 45 | uint16_t setinfo_80; /* 0x00ff */ 46 | uint32_t setinfo_82; /* 0x000020e7 */ /* max sample size?? */ 47 | uint32_t setinfo_86; /* 0x00069fe4 */ /* bit rate (avarge)?? */ 48 | uint32_t setinfo_8a_rate; /* 0x0000ac44 */ 49 | /* end setinfo stuff */ 50 | 51 | }; 52 | 53 | 54 | #endif /* __ALAC__DECOMP_H */ 55 | 56 | -------------------------------------------------------------------------------- /src/bplist.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bplist - 1-level (no recurse) simplified bplist reader & writer 3 | * 4 | * (c) Philippe, philippe_44@outlook.com 5 | * 6 | * See LICENSE 7 | * 8 | */ 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | class bplist { 17 | public: 18 | typedef enum { DICTIONARY = 0xd0, STRING = 0x50, INTEGER = 0x10, ARRAY = 0xa0, DATA = 0x40 } objectId; 19 | 20 | private: 21 | typedef struct { 22 | objectId id; 23 | // don't want to bother with a variant and can't be an union 24 | uint32_t integer; 25 | std::string string; 26 | std::vector data; 27 | } Value; 28 | 29 | struct { 30 | uint8_t unused[5]; 31 | uint8_t sort; 32 | uint8_t ofsSize; 33 | uint8_t refSize; 34 | uint64_t count; 35 | uint64_t topOfs; 36 | uint64_t startOfs; 37 | } trailer = { }; 38 | 39 | std::vector offset, ofsIndex; 40 | std::vector object; 41 | std::map entries; 42 | 43 | void insertObject(objectId id, size_t size); 44 | std::string readKey(size_t& pos); 45 | size_t readCount(size_t& pos); 46 | Value readValue(size_t& pos); 47 | void init(uint8_t* blob, size_t size); 48 | 49 | public: 50 | bplist(); 51 | bplist(std::vector blob) { init(blob.data(), blob.size()); } 52 | bplist(uint8_t* blob, size_t size) { init(blob, size); } 53 | void add(size_t count, ...); 54 | void add(std::string key, std::string value); 55 | std::vector toData(void); 56 | std::string getValueString(std::string key) { return entries[key].string; } 57 | std::vector getValueData(std::string key) { return entries[key].data; } 58 | }; 59 | -------------------------------------------------------------------------------- /src/password.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Squeeze2raop - Squeezelite to AirPlay bridge 3 | * 4 | * (c) Philippe, philippe_44@outlook.com 5 | * 6 | * See LICENSE 7 | * 8 | */ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "platform.h" 15 | #include "cross_log.h" 16 | #include "cross_util.h" 17 | #include "cross_net.h" 18 | #include "mdnssd.h" 19 | 20 | static uint32_t netmask; 21 | static cross_queue_t players; 22 | 23 | /*----------------------------------------------------------------------------*/ 24 | static bool searchCallback(mdnssd_service_t* slist, void *context, bool* stop) { 25 | for (mdnssd_service_t* s = slist; s; s = s->next) { 26 | if (!s->name || (s->host.s_addr != s->addr.s_addr && ((s->host.s_addr & netmask) == (s->addr.s_addr & netmask)))) continue; 27 | 28 | char* am = NULL; 29 | bool (*excluded)(char*, char*) = (bool (*)(char*, char*)) (context); 30 | for (int i = 0; i < s->attr_count; i++) if (!strcasecmp(s->attr[i].name, "am")) am = s->attr[i].value; 31 | if (excluded && !excluded(am, s->name)) queue_insert(&players, strdup(s->name)); 32 | } 33 | return false; 34 | } 35 | 36 | bool AirPlayPassword(struct mdnssd_handle_s* mDNShandle, bool (*excluded)(char*, char*), char** UDN, char** passwd) { 37 | struct mdnssd_handle_s* mDNS = mDNShandle; 38 | 39 | // create a queue for player's name (UDN) 40 | queue_init(&players, false, free); 41 | 42 | if (!mDNS) { 43 | struct in_addr host = get_interface(NULL, NULL, &netmask); 44 | mDNS = mdnssd_init(false, host, true); 45 | if (!mDNS) return false; 46 | } 47 | 48 | printf("please wait 5 seconds...\n"); 49 | mdnssd_query(mDNS, "_raop._tcp.local", false, 5, &searchCallback, excluded); 50 | 51 | // list devices 52 | int idx = 1; 53 | printf("\npick a player to set password\n\n"); 54 | for (char* player = queue_walk_start(&players); player; player = queue_walk_next(&players)) { 55 | char name[128+1]; 56 | sscanf(player, "%*[^@]@%128[^.]", name); 57 | printf("%d - %s\n", idx++, name); 58 | } 59 | queue_walk_end(&players); 60 | 61 | printf("\nenter an index (0 to exit): "); 62 | (void)!scanf("%d", &idx); 63 | if (!idx) return false; 64 | 65 | printf("enter password (can be empty): "); 66 | *passwd = calloc(32 + 1, 1); 67 | // good old scanf on stdin... 68 | (void)!scanf("%*c%32[^\n]", *passwd); 69 | 70 | char* player = queue_walk_start(&players); 71 | while (--idx) player = queue_walk_next(&players); 72 | queue_walk_end(&players); 73 | *UDN = strdup(player); 74 | 75 | if (!mDNShandle) mdnssd_close(mDNS); 76 | return true; 77 | } 78 | -------------------------------------------------------------------------------- /src/raop_server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RAOP: main server interface 3 | * 4 | * (c) Philippe, philippe_44@outlook.com 5 | * 6 | * See LICENSE 7 | * 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "cross_util.h" 13 | #include "mdnssvc.h" 14 | 15 | typedef struct raopsr_metadata_s { 16 | char* artist; 17 | char* title; 18 | char* album; 19 | char* artwork; 20 | } raopsr_metadata_t; 21 | 22 | typedef enum { RAOP_STREAM, RAOP_PLAY, RAOP_FLUSH, RAOP_PAUSE, RAOP_STOP, RAOP_VOLUME, RAOP_METADATA, RAOP_ARTWORK } raopsr_event_t ; 23 | typedef void (*raopsr_cb_t)(void *owner, raopsr_event_t event, ...); 24 | typedef void (*raop_http_cb_t)(void *owner, struct key_data_s *headers, struct key_data_s *response); 25 | 26 | // set http_length to -3 for chunked-encoding, 0 for no content-length or to a positive value 27 | struct raopsr_s* raopsr_create(struct in_addr host, struct mdnsd *svr, char *name, 28 | char *model, unsigned char mac[6], char *stream_codec, bool stream_metadata, 29 | bool drift, bool flush, char *latencies, void *owner, 30 | raopsr_cb_t raop_cb, raop_http_cb_t http_cb, 31 | unsigned short port_base, unsigned short port_range, 32 | int http_length); 33 | void raopsr_update(struct raopsr_s *ctx, char *name, char *model); 34 | void raopsr_delete(struct raopsr_s *ctx); 35 | void raopsr_notify(struct raopsr_s *ctx, raopsr_event_t event, void *param); 36 | 37 | void raopsr_metadata_free(raopsr_metadata_t* data); 38 | void raopsr_metadata_copy(raopsr_metadata_t* dst, raopsr_metadata_t *src); 39 | -------------------------------------------------------------------------------- /src/raop_streamer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RAOP: streamer interface 3 | * 4 | * (c) Philippe, philippe_44@outlook.com 5 | * 6 | * See LICENSE 7 | * 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "raop_server.h" 13 | #include "cross_util.h" 14 | 15 | typedef struct { 16 | unsigned short cport, tport, aport, hport; 17 | struct raopst_s *ctx; 18 | } raopst_resp_t; 19 | 20 | typedef enum { RAOP_STREAMER_PLAY } raopst_event_t; 21 | 22 | typedef void (*raopst_cb_t)(void *owner, raopst_event_t event); 23 | 24 | raopst_resp_t raopst_init(struct in_addr host, struct in_addr peer, char *codec, bool metadata, 25 | bool drift, bool range, char *latencies, 26 | char *aeskey, char *aesiv, char *fmtpstr, 27 | short unsigned pCtrlPort, short unsigned pTimingPort, 28 | void *owner, raopst_cb_t event_cb, raop_http_cb_t http_cb, 29 | unsigned short port_base, unsigned short port_range, 30 | int http_length); 31 | void raopst_end(struct raopst_s *ctx); 32 | bool raopst_flush(struct raopst_s *ctx, unsigned short seqno, unsigned rtptime, bool exit_locked, bool silence); 33 | void raopst_flush_release(struct raopst_s *ctx); 34 | void raopst_record(struct raopst_s *ctx, unsigned short seqno, unsigned rtptime); 35 | void raopst_metadata(struct raopst_s *ctx, raopsr_metadata_t *metadata); 36 | -------------------------------------------------------------------------------- /src/rtsp_client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RAOP : Client to control an AirPlay device, RTSP part 3 | * 4 | * Copyright (C) 2004 Shiro Ninomiya 5 | * Philippe 6 | * 7 | * See LICENSE 8 | * 9 | */ 10 | 11 | #ifndef __RTSP_CLIENT_H 12 | #define __RTSP_CLIENT_H 13 | 14 | typedef struct sock_info_s { 15 | int fd; 16 | uint16_t lport; 17 | uint16_t rport; 18 | } sock_info_t; 19 | 20 | typedef struct rtp_port_s { 21 | sock_info_t time; 22 | sock_info_t ctrl; 23 | sock_info_t audio; 24 | } rtp_port_t; 25 | 26 | struct rtspcl_s *rtspcl_create(char* user_name); 27 | bool rtspcl_destroy(struct rtspcl_s *p); 28 | 29 | bool rtspcl_connect(struct rtspcl_s *p, struct in_addr local, struct in_addr host, unsigned short destport, char *sid); 30 | bool rtspcl_disconnect(struct rtspcl_s *p); 31 | bool rtspcl_is_connected(struct rtspcl_s *p); 32 | bool rtspcl_is_sane(struct rtspcl_s *p); 33 | bool rtspcl_options(struct rtspcl_s *p, key_data_t *rkd); 34 | bool rtspcl_pair_verify(struct rtspcl_s *p, char *secret); 35 | bool rtspcl_auth_setup(struct rtspcl_s *p); 36 | bool rtspcl_announce_sdp(struct rtspcl_s *p, char *sdp, char *passwd); 37 | bool rtspcl_setup(struct rtspcl_s *p, struct rtp_port_s *port, key_data_t *kd); 38 | bool rtspcl_record(struct rtspcl_s *p, uint16_t start_seq, uint32_t start_ts, key_data_t *kd); 39 | bool rtspcl_set_parameter(struct rtspcl_s *p, char *param); 40 | bool rtspcl_flush(struct rtspcl_s *p, uint16_t seq_number, uint32_t timestamp); 41 | bool rtspcl_set_daap(struct rtspcl_s *p, uint32_t timestamp, int count, va_list args); 42 | bool rtspcl_set_artwork(struct rtspcl_s *p, uint32_t timestamp, char *content_type, int size, char *image); 43 | 44 | bool rtspcl_remove_all_exthds(struct rtspcl_s *p); 45 | bool rtspcl_add_exthds(struct rtspcl_s *p, char *key, char *data); 46 | bool rtspcl_mark_del_exthds(struct rtspcl_s *p, char *key); 47 | char* rtspcl_local_ip(struct rtspcl_s *p); 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /targets/freebsd/x86_64/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/freebsd/x86_64/libraop.a -------------------------------------------------------------------------------- /targets/include/raop_server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RAOP: main server interface 3 | * 4 | * (c) Philippe, philippe_44@outlook.com 5 | * 6 | * See LICENSE 7 | * 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "cross_util.h" 13 | #include "mdnssvc.h" 14 | 15 | typedef struct raopsr_metadata_s { 16 | char* artist; 17 | char* title; 18 | char* album; 19 | char* artwork; 20 | } raopsr_metadata_t; 21 | 22 | typedef enum { RAOP_STREAM, RAOP_PLAY, RAOP_FLUSH, RAOP_PAUSE, RAOP_STOP, RAOP_VOLUME, RAOP_METADATA, RAOP_ARTWORK } raopsr_event_t ; 23 | typedef void (*raopsr_cb_t)(void *owner, raopsr_event_t event, ...); 24 | typedef void (*raop_http_cb_t)(void *owner, struct key_data_s *headers, struct key_data_s *response); 25 | 26 | // set http_length to -3 for chunked-encoding, 0 for no content-length or to a positive value 27 | struct raopsr_s* raopsr_create(struct in_addr host, struct mdnsd *svr, char *name, 28 | char *model, unsigned char mac[6], char *stream_codec, bool stream_metadata, 29 | bool drift, bool flush, char *latencies, void *owner, 30 | raopsr_cb_t raop_cb, raop_http_cb_t http_cb, 31 | unsigned short port_base, unsigned short port_range, 32 | int http_length); 33 | void raopsr_update(struct raopsr_s *ctx, char *name, char *model); 34 | void raopsr_delete(struct raopsr_s *ctx); 35 | void raopsr_notify(struct raopsr_s *ctx, raopsr_event_t event, void *param); 36 | 37 | void raopsr_metadata_free(raopsr_metadata_t* data); 38 | void raopsr_metadata_copy(raopsr_metadata_t* dst, raopsr_metadata_t *src); 39 | -------------------------------------------------------------------------------- /targets/include/raop_streamer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RAOP: streamer interface 3 | * 4 | * (c) Philippe, philippe_44@outlook.com 5 | * 6 | * See LICENSE 7 | * 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "raop_server.h" 13 | #include "cross_util.h" 14 | 15 | typedef struct { 16 | unsigned short cport, tport, aport, hport; 17 | struct raopst_s *ctx; 18 | } raopst_resp_t; 19 | 20 | typedef enum { RAOP_STREAMER_PLAY } raopst_event_t; 21 | 22 | typedef void (*raopst_cb_t)(void *owner, raopst_event_t event); 23 | 24 | raopst_resp_t raopst_init(struct in_addr host, struct in_addr peer, char *codec, bool metadata, 25 | bool drift, bool range, char *latencies, 26 | char *aeskey, char *aesiv, char *fmtpstr, 27 | short unsigned pCtrlPort, short unsigned pTimingPort, 28 | void *owner, raopst_cb_t event_cb, raop_http_cb_t http_cb, 29 | unsigned short port_base, unsigned short port_range, 30 | int http_length); 31 | void raopst_end(struct raopst_s *ctx); 32 | bool raopst_flush(struct raopst_s *ctx, unsigned short seqno, unsigned rtptime, bool exit_locked, bool silence); 33 | void raopst_flush_release(struct raopst_s *ctx); 34 | void raopst_record(struct raopst_s *ctx, unsigned short seqno, unsigned rtptime); 35 | void raopst_metadata(struct raopst_s *ctx, raopsr_metadata_t *metadata); 36 | -------------------------------------------------------------------------------- /targets/linux/aarch64/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/aarch64/libraop.a -------------------------------------------------------------------------------- /targets/linux/arm/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/arm/libraop.a -------------------------------------------------------------------------------- /targets/linux/armv5/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/armv5/libraop.a -------------------------------------------------------------------------------- /targets/linux/armv6/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/armv6/libraop.a -------------------------------------------------------------------------------- /targets/linux/mips/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/mips/libraop.a -------------------------------------------------------------------------------- /targets/linux/mipsel/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/mipsel/libraop.a -------------------------------------------------------------------------------- /targets/linux/powerpc/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/powerpc/libraop.a -------------------------------------------------------------------------------- /targets/linux/sparc64/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/sparc64/libraop.a -------------------------------------------------------------------------------- /targets/linux/x86/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/x86/libraop.a -------------------------------------------------------------------------------- /targets/linux/x86_64/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/linux/x86_64/libraop.a -------------------------------------------------------------------------------- /targets/macos/arm64/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/macos/arm64/libraop.a -------------------------------------------------------------------------------- /targets/macos/x86_64/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/macos/x86_64/libraop.a -------------------------------------------------------------------------------- /targets/solaris/x86_64/libraop.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/solaris/x86_64/libraop.a -------------------------------------------------------------------------------- /targets/win32/x86/libraop.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/win32/x86/libraop.lib -------------------------------------------------------------------------------- /targets/win32/x86/libraop.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/win32/x86/libraop.pdb -------------------------------------------------------------------------------- /targets/win32/x86/libraop_d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/win32/x86/libraop_d.lib -------------------------------------------------------------------------------- /targets/win32/x86/libraop_d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/philippe44/libraop/73dcab92c88270b16b78315c883cafdb9896f16a/targets/win32/x86/libraop_d.pdb --------------------------------------------------------------------------------