├── ripple-client ├── .gitignore └── src │ ├── test │ └── java │ │ └── com │ │ └── ripple │ │ └── client │ │ ├── RequestTest.java │ │ ├── blobvault │ │ └── BlobVaultTest.java │ │ └── subscriptions │ │ └── ledger │ │ └── ClearedLedgersSetTest.java │ └── main │ └── java │ └── com │ └── ripple │ └── client │ ├── transport │ ├── TransportError.java │ ├── TransportEventHandler.java │ └── WebSocketTransport.java │ ├── enums │ └── Message.java │ ├── subscriptions │ └── TransactionSubscriptionManager.java │ ├── async │ ├── Composed2.java │ └── Composed3.java │ └── pubsub │ └── CallbackContext.java ├── ripple-core ├── .gitignore └── src │ ├── test │ └── java │ │ └── com │ │ └── ripple │ │ ├── core │ │ ├── types │ │ │ └── shamap │ │ │ │ └── README.md │ │ ├── coretypes │ │ │ ├── STArrayTest.java │ │ │ ├── uint │ │ │ │ └── UIntTest.java │ │ │ └── QualityTest.java │ │ └── serialized │ │ │ └── BytesListTest.java │ │ ├── crypto │ │ └── sjcljson │ │ │ └── JSEscapeTest.java │ │ └── encodings │ │ └── B58IdentifierTest.java │ └── main │ └── java │ └── com │ └── ripple │ ├── core │ ├── fields │ │ ├── BlobField.java │ │ ├── AmountField.java │ │ ├── HasField.java │ │ ├── PathSetField.java │ │ ├── STArrayField.java │ │ ├── UInt16Field.java │ │ ├── UInt32Field.java │ │ ├── UInt64Field.java │ │ ├── UInt8Field.java │ │ ├── AccountIDField.java │ │ ├── Hash128Field.java │ │ ├── Hash160Field.java │ │ ├── Hash256Field.java │ │ ├── STObjectField.java │ │ └── Vector256Field.java │ ├── coretypes │ │ ├── hash │ │ │ └── prefixes │ │ │ │ └── Prefix.java │ │ └── Flags.java │ ├── types │ │ ├── shamap │ │ │ ├── LeafWalker.java │ │ │ ├── TreeWalker.java │ │ │ ├── LedgerEntryVisitor.java │ │ │ ├── TransactionResultVisitor.java │ │ │ ├── HashedTreeWalker.java │ │ │ └── ShaMapItem.java │ │ └── known │ │ │ ├── tx │ │ │ └── txns │ │ │ │ ├── OfferCancel.java │ │ │ │ ├── TicketCreate.java │ │ │ │ └── TicketCancel.java │ │ │ └── sle │ │ │ ├── LedgerHashes.java │ │ │ ├── entries │ │ │ └── OfferDirectory.java │ │ │ └── ThreadedLedgerEntry.java │ └── serialized │ │ ├── BytesSink.java │ │ ├── SerializedType.java │ │ ├── MultiSink.java │ │ └── StreamSink.java │ ├── encodings │ ├── base58 │ │ └── EncodingFormatException.java │ └── common │ │ ├── B64.java │ │ └── B16.java │ ├── utils │ └── Utils.java │ └── crypto │ └── ecdsa │ └── IKeyPair.java ├── ripple-examples ├── .gitignore ├── ripple-cli │ ├── .gitignore │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── ripple │ │ │ └── cli │ │ │ ├── shamapanalysis │ │ │ └── README.md │ │ │ └── log │ │ │ └── Log.java │ │ └── test │ │ └── java │ │ └── com │ │ └── ripple │ │ └── cli │ │ └── AppTest.java ├── ripple-android │ ├── .gitignore │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-ldpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ripple_logo_large.png │ │ │ └── ripple_clover_launcher.png │ │ ├── values │ │ │ ├── colors.xml │ │ │ ├── arrays.xml │ │ │ └── strings.xml │ │ └── layout │ │ │ └── contacts_text_view.xml │ ├── gen │ │ └── com │ │ │ └── ripple │ │ │ └── android │ │ │ └── BuildConfig.java │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── ripple │ │ │ └── android │ │ │ ├── Logger.java │ │ │ ├── RippleApplication.java │ │ │ ├── JSON.java │ │ │ ├── client │ │ │ └── AndroidClient.java │ │ │ └── activities │ │ │ └── SplashScreen.java │ └── project.properties ├── ripple-java-8 │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── ripple │ │ └── java8 │ │ └── utils │ │ └── Func.java └── pom.xml ├── ripple-bouncycastle ├── .gitignore ├── src │ └── main │ │ └── java │ │ └── org │ │ └── ripple │ │ └── bouncycastle │ │ ├── x509 │ │ ├── X509StoreParameters.java │ │ ├── NoSuchStoreException.java │ │ ├── NoSuchParserException.java │ │ ├── util │ │ │ ├── StreamParser.java │ │ │ └── StreamParsingException.java │ │ ├── X509StoreSpi.java │ │ └── ExtCertificateEncodingException.java │ │ ├── asn1 │ │ ├── ASN1String.java │ │ ├── DERTags.java │ │ ├── BERApplicationSpecific.java │ │ ├── ASN1Generator.java │ │ ├── ASN1TaggedObjectParser.java │ │ ├── ASN1Encodable.java │ │ ├── x9 │ │ │ └── X9ECParametersHolder.java │ │ ├── DERBoolean.java │ │ ├── misc │ │ │ ├── NetscapeRevocationURL.java │ │ │ └── VerisignCzagExtension.java │ │ ├── smime │ │ │ ├── SMIMEAttributes.java │ │ │ └── SMIMECapabilitiesAttribute.java │ │ ├── InMemoryRepresentable.java │ │ ├── ASN1Encoding.java │ │ ├── eac │ │ │ ├── CertificationAuthorityReference.java │ │ │ └── BidirectionalMap.java │ │ ├── ASN1OctetStringParser.java │ │ ├── DEREncodableVector.java │ │ ├── BERFactory.java │ │ ├── DERFactory.java │ │ ├── DERUTCTime.java │ │ ├── ASN1Exception.java │ │ ├── ASN1ParsingException.java │ │ ├── x509 │ │ │ └── qualified │ │ │ │ ├── RFC3739QCObjectIdentifiers.java │ │ │ │ └── ETSIQCObjectIdentifiers.java │ │ ├── ASN1ApplicationSpecificParser.java │ │ ├── ASN1SetParser.java │ │ ├── DERObjectIdentifier.java │ │ ├── ASN1SequenceParser.java │ │ ├── DERGeneralizedTime.java │ │ ├── util │ │ │ └── Dump.java │ │ ├── DERInteger.java │ │ ├── DLOutputStream.java │ │ ├── DERNull.java │ │ ├── LimitedInputStream.java │ │ └── crmf │ │ │ └── SubsequentMessage.java │ │ ├── math │ │ ├── ec │ │ │ ├── ECPointMap.java │ │ │ ├── endo │ │ │ │ ├── GLVEndomorphism.java │ │ │ │ └── ECEndomorphism.java │ │ │ ├── PreCompInfo.java │ │ │ ├── ReferenceMultiplier.java │ │ │ ├── ScaleXPointMap.java │ │ │ ├── ScaleYPointMap.java │ │ │ ├── ECConstants.java │ │ │ ├── DoubleAddMultiplier.java │ │ │ ├── ECMultiplier.java │ │ │ ├── MontgomeryLadderMultiplier.java │ │ │ ├── ZSignedDigitL2RMultiplier.java │ │ │ ├── ZSignedDigitR2LMultiplier.java │ │ │ └── WTauNafPreCompInfo.java │ │ └── field │ │ │ ├── ExtensionField.java │ │ │ ├── PolynomialExtensionField.java │ │ │ ├── FiniteField.java │ │ │ └── Polynomial.java │ │ ├── crypto │ │ ├── tls │ │ │ ├── TlsClientContext.java │ │ │ ├── TlsServerContext.java │ │ │ ├── TlsCredentials.java │ │ │ ├── AbstractTlsCredentials.java │ │ │ ├── ChangeCipherSpec.java │ │ │ ├── TlsPSKIdentityManager.java │ │ │ ├── NameType.java │ │ │ ├── CertificateStatusType.java │ │ │ ├── AbstractTlsAgreementCredentials.java │ │ │ ├── AbstractTlsEncryptionCredentials.java │ │ │ ├── UserMappingType.java │ │ │ ├── SupplementalDataType.java │ │ │ ├── TlsCompression.java │ │ │ ├── TlsSession.java │ │ │ ├── DTLSHandshakeRetransmit.java │ │ │ ├── TlsPSKIdentity.java │ │ │ ├── TlsEncryptionCredentials.java │ │ │ ├── ClientAuthenticationType.java │ │ │ ├── ServerOnlyTlsAuthentication.java │ │ │ ├── SignerInputBuffer.java │ │ │ ├── DigestInputBuffer.java │ │ │ ├── TlsSignerCredentials.java │ │ │ ├── TlsAgreementCredentials.java │ │ │ ├── ECPointFormat.java │ │ │ ├── SignatureAlgorithm.java │ │ │ ├── ConnectionEnd.java │ │ │ ├── ContentType.java │ │ │ ├── TlsCipherFactory.java │ │ │ ├── TlsNullCompression.java │ │ │ ├── CertChainType.java │ │ │ ├── AbstractTlsCipherFactory.java │ │ │ ├── AbstractTlsSignerCredentials.java │ │ │ ├── SRTPProtectionProfile.java │ │ │ ├── CompressionMethod.java │ │ │ ├── ECBasisType.java │ │ │ ├── HeartbeatMode.java │ │ │ ├── TlsCipher.java │ │ │ ├── HashAlgorithm.java │ │ │ ├── HeartbeatMessageType.java │ │ │ ├── CipherType.java │ │ │ ├── TlsClientContextImpl.java │ │ │ ├── TlsServerContextImpl.java │ │ │ ├── TlsSRPGroupVerifier.java │ │ │ ├── MaxFragmentLength.java │ │ │ ├── SupplementalDataEntry.java │ │ │ ├── TlsHandshakeHash.java │ │ │ ├── DatagramTransport.java │ │ │ ├── FiniteFieldDHEGroup.java │ │ │ ├── PRFAlgorithm.java │ │ │ ├── BulkCipherAlgorithm.java │ │ │ ├── AlertLevel.java │ │ │ ├── MACAlgorithm.java │ │ │ └── ClientCertificateType.java │ │ ├── CipherParameters.java │ │ ├── prng │ │ │ ├── EntropySourceProvider.java │ │ │ ├── DRBGProvider.java │ │ │ └── EntropySource.java │ │ ├── modes │ │ │ └── gcm │ │ │ │ ├── GCMMultiplier.java │ │ │ │ ├── GCMExponentiator.java │ │ │ │ └── BasicGCMMultiplier.java │ │ ├── DerivationParameters.java │ │ ├── KeyEncoder.java │ │ ├── OutputLengthException.java │ │ ├── SkippingStreamCipher.java │ │ ├── engines │ │ │ ├── AESWrapPadEngine.java │ │ │ ├── SEEDWrapEngine.java │ │ │ └── CamelliaWrapEngine.java │ │ ├── ec │ │ │ ├── ECPairTransform.java │ │ │ ├── ECEncryptor.java │ │ │ ├── ECDecryptor.java │ │ │ ├── ECPairFactorTransform.java │ │ │ └── ECUtil.java │ │ ├── KeyParser.java │ │ ├── MacDerivationFunction.java │ │ ├── ExtendedDigest.java │ │ ├── DerivationFunction.java │ │ ├── DigestDerivationFunction.java │ │ ├── params │ │ │ ├── AsymmetricKeyParameter.java │ │ │ ├── SRP6GroupParameters.java │ │ │ ├── ECPrivateKeyParameters.java │ │ │ ├── DSAKeyParameters.java │ │ │ ├── ECKeyParameters.java │ │ │ ├── DSAPrivateKeyParameters.java │ │ │ ├── DSAPublicKeyParameters.java │ │ │ ├── ECPublicKeyParameters.java │ │ │ ├── GOST3410KeyParameters.java │ │ │ ├── ISO18033KDFParameters.java │ │ │ ├── GOST3410PrivateKeyParameters.java │ │ │ ├── GOST3410PublicKeyParameters.java │ │ │ ├── CCMParameters.java │ │ │ ├── DSAKeyGenerationParameters.java │ │ │ ├── KDFParameters.java │ │ │ ├── KeyParameter.java │ │ │ ├── ParametersWithSBox.java │ │ │ ├── ECKeyGenerationParameters.java │ │ │ ├── RSAKeyParameters.java │ │ │ ├── MGFParameters.java │ │ │ ├── GOST3410KeyGenerationParameters.java │ │ │ ├── CramerShoupKeyGenerationParameters.java │ │ │ └── DHKeyGenerationParameters.java │ │ ├── Wrapper.java │ │ ├── io │ │ │ ├── CipherIOException.java │ │ │ ├── InvalidCipherTextIOException.java │ │ │ └── SignerOutputStream.java │ │ ├── EphemeralKeyPair.java │ │ ├── KeyEncapsulation.java │ │ ├── RuntimeCryptoException.java │ │ ├── generators │ │ │ ├── KDF1BytesGenerator.java │ │ │ └── KDF2BytesGenerator.java │ │ ├── BasicAgreement.java │ │ ├── AsymmetricCipherKeyPairGenerator.java │ │ ├── MaxBytesExceededException.java │ │ ├── digests │ │ │ └── EncodableDigest.java │ │ ├── macs │ │ │ └── CMacWithIV.java │ │ ├── DataLengthException.java │ │ └── Committer.java │ │ ├── util │ │ ├── test │ │ │ ├── Test.java │ │ │ ├── TestResult.java │ │ │ ├── TestFailedException.java │ │ │ └── UncloseableOutputStream.java │ │ ├── Selector.java │ │ ├── Times.java │ │ ├── Shorts.java │ │ ├── Store.java │ │ ├── StreamParser.java │ │ ├── StoreException.java │ │ ├── io │ │ │ ├── StreamOverflowException.java │ │ │ └── pem │ │ │ │ ├── PemObjectGenerator.java │ │ │ │ ├── PemObjectParser.java │ │ │ │ └── PemGenerationException.java │ │ ├── StreamParsingException.java │ │ ├── Iterable.java │ │ ├── Integers.java │ │ ├── Encodable.java │ │ ├── encoders │ │ │ ├── DecoderException.java │ │ │ ├── EncoderException.java │ │ │ ├── Encoder.java │ │ │ └── Translator.java │ │ ├── MemoableResetException.java │ │ └── StringList.java │ │ ├── pqc │ │ ├── crypto │ │ │ ├── gmss │ │ │ │ ├── GMSSDigestProvider.java │ │ │ │ ├── GMSSKeyParameters.java │ │ │ │ └── GMSSKeyGenerationParameters.java │ │ │ ├── ntru │ │ │ │ ├── NTRUParameters.java │ │ │ │ └── NTRUEncryptionKeyParameters.java │ │ │ ├── mceliece │ │ │ │ ├── McElieceKeyParameters.java │ │ │ │ ├── McElieceCCA2KeyParameters.java │ │ │ │ ├── McElieceKeyGenerationParameters.java │ │ │ │ └── McElieceCCA2KeyGenerationParameters.java │ │ │ └── rainbow │ │ │ │ ├── RainbowKeyParameters.java │ │ │ │ └── RainbowKeyGenerationParameters.java │ │ ├── math │ │ │ ├── ntru │ │ │ │ └── polynomial │ │ │ │ │ ├── Constants.java │ │ │ │ │ ├── TernaryPolynomial.java │ │ │ │ │ └── Resultant.java │ │ │ └── linearalgebra │ │ │ │ └── RandUtils.java │ │ └── jcajce │ │ │ └── spec │ │ │ └── GMSSKeySpec.java │ │ ├── jce │ │ ├── interfaces │ │ │ ├── ElGamalKey.java │ │ │ ├── GOST3410Key.java │ │ │ ├── GOST3410PrivateKey.java │ │ │ ├── ElGamalPublicKey.java │ │ │ ├── GOST3410PublicKey.java │ │ │ ├── ElGamalPrivateKey.java │ │ │ ├── BCKeyStore.java │ │ │ ├── ECPrivateKey.java │ │ │ ├── ECPublicKey.java │ │ │ ├── ECKey.java │ │ │ ├── GOST3410Params.java │ │ │ ├── MQVPublicKey.java │ │ │ ├── IESKey.java │ │ │ ├── PKCS12BagAttributeCarrier.java │ │ │ ├── MQVPrivateKey.java │ │ │ └── ECPointEncoder.java │ │ ├── provider │ │ │ ├── PKIXNameConstraintValidatorException.java │ │ │ ├── ExtCRLException.java │ │ │ └── AnnotatedException.java │ │ ├── spec │ │ │ ├── ElGamalKeySpec.java │ │ │ ├── RepeatedSecretKeySpec.java │ │ │ ├── ECKeySpec.java │ │ │ ├── ECNamedCurveGenParameterSpec.java │ │ │ ├── ElGamalGenParameterSpec.java │ │ │ ├── ElGamalPublicKeySpec.java │ │ │ ├── ElGamalPrivateKeySpec.java │ │ │ └── ECPrivateKeySpec.java │ │ └── exception │ │ │ ├── ExtIOException.java │ │ │ ├── ExtCertificateEncodingException.java │ │ │ ├── ExtException.java │ │ │ └── ExtCertPathBuilderException.java │ │ ├── jcajce │ │ ├── provider │ │ │ ├── symmetric │ │ │ │ └── util │ │ │ │ │ └── BlockCipherProvider.java │ │ │ ├── util │ │ │ │ ├── AlgorithmProvider.java │ │ │ │ └── AsymmetricKeyInfoConverter.java │ │ │ ├── asymmetric │ │ │ │ ├── util │ │ │ │ │ ├── DSAEncoder.java │ │ │ │ │ └── ExtendedInvalidKeySpecException.java │ │ │ │ └── x509 │ │ │ │ │ └── ExtCRLException.java │ │ │ └── config │ │ │ │ └── ProviderConfiguration.java │ │ ├── PKIXCRLStore.java │ │ ├── PKIXCertStore.java │ │ ├── spec │ │ │ └── RepeatedSecretKeySpec.java │ │ ├── io │ │ │ └── MacOutputStream.java │ │ └── util │ │ │ └── BCJcaJceHelper.java │ │ └── i18n │ │ └── filter │ │ ├── UntrustedUrlInput.java │ │ ├── TrustedInput.java │ │ └── Filter.java └── pom.xml ├── ripple-client-transports ├── .gitignore ├── ripple-client-java-websocket-transport │ ├── .gitignore │ └── pom.xml └── .classpath ├── .license-accept-android.sh ├── LICENSE └── .gitignore /ripple-client/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /ripple-core/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /ripple-examples/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /ripple-bouncycastle/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /ripple-client-transports/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /ripple-examples/ripple-cli/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /bin/ 3 | -------------------------------------------------------------------------------- /ripple-core/src/test/java/com/ripple/core/types/shamap/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /target 3 | -------------------------------------------------------------------------------- /ripple-client-transports/ripple-client-java-websocket-transport/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /bin/ 3 | -------------------------------------------------------------------------------- /ripple-client/src/test/java/com/ripple/client/RequestTest.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client; 2 | 3 | public class RequestTest { 4 | } 5 | -------------------------------------------------------------------------------- /ripple-client/src/main/java/com/ripple/client/transport/TransportError.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.transport; 2 | 3 | public enum TransportError { 4 | } 5 | -------------------------------------------------------------------------------- /ripple-client/src/test/java/com/ripple/client/blobvault/BlobVaultTest.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.blobvault; 2 | 3 | public class BlobVaultTest { 4 | 5 | } -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/BlobField.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class BlobField implements HasField{} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/AmountField.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class AmountField implements HasField {} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/HasField.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public interface HasField { 4 | Field getField(); 5 | } 6 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/PathSetField.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class PathSetField implements HasField{} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/STArrayField.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class STArrayField implements HasField{} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/UInt16Field.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class UInt16Field implements HasField {} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/UInt32Field.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class UInt32Field implements HasField {} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/UInt64Field.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class UInt64Field implements HasField {} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/UInt8Field.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class UInt8Field implements HasField {} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/AccountIDField.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class AccountIDField implements HasField {} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/Hash128Field.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class Hash128Field implements HasField {} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/Hash160Field.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class Hash160Field implements HasField {} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/Hash256Field.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class Hash256Field implements HasField {} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/STObjectField.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class STObjectField implements HasField{} 4 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/fields/Vector256Field.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.fields; 2 | 3 | public abstract class Vector256Field implements HasField{} 4 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/x509/X509StoreParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.x509; 2 | 3 | public interface X509StoreParameters 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/coretypes/hash/prefixes/Prefix.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.coretypes.hash.prefixes; 2 | 3 | public interface Prefix { 4 | byte[] bytes(); 5 | } 6 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/shamap/LeafWalker.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.shamap; 2 | 3 | public interface LeafWalker { 4 | void onLeaf(ShaMapLeaf shaMapLeaf); 5 | } 6 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripple-unmaintained/ripple-lib-java/HEAD/ripple-examples/ripple-android/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripple-unmaintained/ripple-lib-java/HEAD/ripple-examples/ripple-android/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripple-unmaintained/ripple-lib-java/HEAD/ripple-examples/ripple-android/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripple-unmaintained/ripple-lib-java/HEAD/ripple-examples/ripple-android/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ripple-examples/ripple-cli/src/main/java/com/ripple/cli/shamapanalysis/README.md: -------------------------------------------------------------------------------- 1 | ShaMapInnerNodeAnalysis 2 | ----------------------- 3 | 4 | This example extends the ShaMap class, with instrumentation. -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1String.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | public interface ASN1String 4 | { 5 | public String getString(); 6 | } 7 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/ECPointMap.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | public interface ECPointMap 4 | { 5 | ECPoint map(ECPoint p); 6 | } 7 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/serialized/BytesSink.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.serialized; 2 | 3 | public interface BytesSink { 4 | void add(byte aByte); 5 | void add(byte[] bytes); 6 | } 7 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/drawable-xhdpi/ripple_logo_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripple-unmaintained/ripple-lib-java/HEAD/ripple-examples/ripple-android/res/drawable-xhdpi/ripple_logo_large.png -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsClientContext.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public interface TlsClientContext 4 | extends TlsContext 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsServerContext.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public interface TlsServerContext 4 | extends TlsContext 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/drawable-xhdpi/ripple_clover_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ripple-unmaintained/ripple-lib-java/HEAD/ripple-examples/ripple-android/res/drawable-xhdpi/ripple_clover_launcher.png -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsCredentials.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public interface TlsCredentials 4 | { 5 | Certificate getCertificate(); 6 | } 7 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/test/Test.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.test; 2 | 3 | public interface Test 4 | { 5 | String getName(); 6 | 7 | TestResult perform(); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DERTags.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | /** 4 | * @deprecated use BERTags 5 | */ 6 | public interface DERTags 7 | extends BERTags 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/CipherParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * all parameter classes implement this. 5 | */ 6 | public interface CipherParameters 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/AbstractTlsCredentials.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public abstract class AbstractTlsCredentials 4 | implements TlsCredentials 5 | { 6 | } 7 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/ChangeCipherSpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public class ChangeCipherSpec 4 | { 5 | public static final short change_cipher_spec = 1; 6 | } 7 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/shamap/TreeWalker.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.shamap; 2 | 3 | public interface TreeWalker { 4 | public void onLeaf(ShaMapLeaf leaf); 5 | public void onInner(ShaMapInner inner); 6 | } 7 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/gen/com/ripple/android/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.ripple.android; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/prng/EntropySourceProvider.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.prng; 2 | 3 | public interface EntropySourceProvider 4 | { 5 | EntropySource get(final int bitsRequired); 6 | } 7 | -------------------------------------------------------------------------------- /ripple-examples/ripple-cli/src/main/java/com/ripple/cli/log/Log.java: -------------------------------------------------------------------------------- 1 | package com.ripple.cli.log; 2 | 3 | public class Log { 4 | public static void log(String fmt, Object... args) { 5 | System.out.printf(fmt + "\n", args); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/modes/gcm/GCMMultiplier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.modes.gcm; 2 | 3 | public interface GCMMultiplier 4 | { 5 | void init(byte[] H); 6 | void multiplyH(byte[] x); 7 | } 8 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/Selector.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | public interface Selector 4 | extends Cloneable 5 | { 6 | boolean match(T obj); 7 | 8 | Object clone(); 9 | } 10 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/DerivationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * Parameters for key/byte stream derivation classes 5 | */ 6 | public interface DerivationParameters 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/Times.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | public final class Times 4 | { 5 | public static long nanoTime() 6 | { 7 | return System.nanoTime(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ripple-client/src/main/java/com/ripple/client/enums/Message.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.enums; 2 | 3 | public enum Message { 4 | ledgerClosed, 5 | response, 6 | transaction, 7 | serverStatus, 8 | path_find, 9 | error 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsPSKIdentityManager.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public interface TlsPSKIdentityManager 4 | { 5 | byte[] getHint(); 6 | 7 | byte[] getPSK(byte[] identity); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/field/ExtensionField.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.field; 2 | 3 | public interface ExtensionField extends FiniteField 4 | { 5 | FiniteField getSubfield(); 6 | 7 | int getDegree(); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/field/PolynomialExtensionField.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.field; 2 | 3 | public interface PolynomialExtensionField extends ExtensionField 4 | { 5 | Polynomial getMinimalPolynomial(); 6 | } 7 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/Shorts.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | public class Shorts 4 | { 5 | public static Short valueOf(short value) 6 | { 7 | return Short.valueOf(value); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ripple-core/src/test/java/com/ripple/core/coretypes/STArrayTest.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.coretypes; 2 | 3 | import org.junit.Test; 4 | 5 | public class STArrayTest { 6 | @Test 7 | public void testStoringSubclasses() throws Exception { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/NameType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public class NameType 4 | { 5 | /* 6 | * RFC 3546 3.1. 7 | */ 8 | public static final short host_name = 0; 9 | } 10 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/shamap/LedgerEntryVisitor.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.shamap; 2 | 3 | import com.ripple.core.types.known.sle.LedgerEntry; 4 | 5 | public interface LedgerEntryVisitor { 6 | public void onEntry(LedgerEntry entry); 7 | } 8 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #322 4 | #233 5 | #ff3dffc0 6 | -------------------------------------------------------------------------------- /.license-accept-android.sh: -------------------------------------------------------------------------------- 1 | function license_accepted_android () 2 | { 3 | expect -c "$(cat < 6 | { 7 | Collection getMatches(Selector selector) 8 | throws StoreException; 9 | } 10 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/prng/DRBGProvider.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.prng; 2 | 3 | import org.ripple.bouncycastle.crypto.prng.drbg.SP80090DRBG; 4 | 5 | interface DRBGProvider 6 | { 7 | SP80090DRBG get(EntropySource entropySource); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/endo/GLVEndomorphism.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec.endo; 2 | 3 | import java.math.BigInteger; 4 | 5 | public interface GLVEndomorphism extends ECEndomorphism 6 | { 7 | BigInteger[] decomposeScalar(BigInteger k); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/field/FiniteField.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.field; 2 | 3 | import java.math.BigInteger; 4 | 5 | public interface FiniteField 6 | { 7 | BigInteger getCharacteristic(); 8 | 9 | int getDimension(); 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/AbstractTlsAgreementCredentials.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public abstract class AbstractTlsAgreementCredentials 4 | extends AbstractTlsCredentials 5 | implements TlsAgreementCredentials 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/AbstractTlsEncryptionCredentials.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public abstract class AbstractTlsEncryptionCredentials 4 | extends AbstractTlsCredentials 5 | implements TlsEncryptionCredentials 6 | { 7 | } 8 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/ElGamalKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import org.ripple.bouncycastle.jce.spec.ElGamalParameterSpec; 4 | 5 | public interface ElGamalKey 6 | { 7 | public ElGamalParameterSpec getParameters(); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/shamap/TransactionResultVisitor.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.shamap; 2 | import com.ripple.core.types.known.tx.result.TransactionResult; 3 | 4 | public interface TransactionResultVisitor { 5 | public void onTransaction(TransactionResult tx); 6 | } 7 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/KeyEncoder.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | import org.ripple.bouncycastle.crypto.params.AsymmetricKeyParameter; 4 | 5 | public interface KeyEncoder 6 | { 7 | byte[] getEncoded(AsymmetricKeyParameter keyParameter); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/GOST3410Key.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | /** 4 | * Main interface for a GOST 3410-94 key. 5 | */ 6 | public interface GOST3410Key 7 | { 8 | 9 | public GOST3410Params getParameters(); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/test/TestResult.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.test; 2 | 3 | public interface TestResult 4 | { 5 | public boolean isSuccessful(); 6 | 7 | public Throwable getException(); 8 | 9 | public String toString(); 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/x509/NoSuchStoreException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.x509; 2 | 3 | public class NoSuchStoreException 4 | extends Exception 5 | { 6 | public NoSuchStoreException(String message) 7 | { 8 | super(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/provider/symmetric/util/BlockCipherProvider.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.provider.symmetric.util; 2 | 3 | import org.ripple.bouncycastle.crypto.BlockCipher; 4 | 5 | public interface BlockCipherProvider 6 | { 7 | BlockCipher get(); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/x509/NoSuchParserException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.x509; 2 | 3 | public class NoSuchParserException 4 | extends Exception 5 | { 6 | public NoSuchParserException(String message) 7 | { 8 | super(message); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/OutputLengthException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | public class OutputLengthException 4 | extends DataLengthException 5 | { 6 | public OutputLengthException(String msg) 7 | { 8 | super(msg); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/SkippingStreamCipher.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * General interface for a stream cipher that supports skipping. 5 | */ 6 | public interface SkippingStreamCipher 7 | extends StreamCipher, SkippingCipher 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/engines/AESWrapPadEngine.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.engines; 2 | 3 | public class AESWrapPadEngine 4 | extends RFC5649WrapEngine 5 | { 6 | public AESWrapPadEngine() 7 | { 8 | super(new AESEngine()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/UserMappingType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 4681 5 | */ 6 | public class UserMappingType 7 | { 8 | /* 9 | * RFC 4681 10 | */ 11 | public static final short upn_domain_hint = 64; 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/ntru/NTRUParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.ntru; 2 | 3 | public class NTRUParameters 4 | { 5 | public static final int TERNARY_POLYNOMIAL_TYPE_SIMPLE = 0; 6 | public static final int TERNARY_POLYNOMIAL_TYPE_PRODUCT = 1; 7 | } 8 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/GOST3410PrivateKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.math.BigInteger; 4 | 5 | public interface GOST3410PrivateKey extends GOST3410Key, java.security.PrivateKey 6 | { 7 | 8 | public BigInteger getX(); 9 | } 10 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/shamap/HashedTreeWalker.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.shamap; 2 | 3 | import com.ripple.core.coretypes.hash.Hash256; 4 | 5 | public interface HashedTreeWalker { 6 | public void onLeaf(Hash256 h, ShaMapLeaf le); 7 | public void onInner(Hash256 h, ShaMapInner inner); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/SupplementalDataType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 4680 5 | */ 6 | public class SupplementalDataType 7 | { 8 | /* 9 | * RFC 4681 10 | */ 11 | public static final int user_mapping_data = 0; 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/endo/ECEndomorphism.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec.endo; 2 | 3 | import org.ripple.bouncycastle.math.ec.ECPointMap; 4 | 5 | public interface ECEndomorphism 6 | { 7 | ECPointMap getPointMap(); 8 | 9 | boolean hasEfficientPointMap(); 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/StreamParser.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | import java.util.Collection; 4 | 5 | public interface StreamParser 6 | { 7 | Object read() throws StreamParsingException; 8 | 9 | Collection readAll() throws StreamParsingException; 10 | } 11 | -------------------------------------------------------------------------------- /ripple-client/src/main/java/com/ripple/client/subscriptions/TransactionSubscriptionManager.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.subscriptions; 2 | import com.ripple.core.types.known.tx.result.TransactionResult; 3 | 4 | public interface TransactionSubscriptionManager { 5 | public void notifyTransactionResult(TransactionResult tr); 6 | } 7 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsCompression.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.OutputStream; 4 | 5 | public interface TlsCompression 6 | { 7 | OutputStream compress(OutputStream output); 8 | 9 | OutputStream decompress(OutputStream output); 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsSession.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public interface TlsSession 4 | { 5 | SessionParameters exportSessionParameters(); 6 | 7 | byte[] getSessionID(); 8 | 9 | void invalidate(); 10 | 11 | boolean isResumable(); 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/field/Polynomial.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.field; 2 | 3 | public interface Polynomial 4 | { 5 | int getDegree(); 6 | 7 | // BigInteger[] getCoefficients(); 8 | 9 | int[] getExponentsPresent(); 10 | 11 | // Term[] getNonZeroTerms(); 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/x509/util/StreamParser.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.x509.util; 2 | 3 | import java.util.Collection; 4 | 5 | public interface StreamParser 6 | { 7 | Object read() throws StreamParsingException; 8 | 9 | Collection readAll() throws StreamParsingException; 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/DTLSHandshakeRetransmit.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.IOException; 4 | 5 | interface DTLSHandshakeRetransmit 6 | { 7 | void receivedHandshakeRecord(int epoch, byte[] buf, int off, int len) 8 | throws IOException; 9 | } 10 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/ElGamalPublicKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.math.BigInteger; 4 | import java.security.PublicKey; 5 | 6 | public interface ElGamalPublicKey 7 | extends ElGamalKey, PublicKey 8 | { 9 | public BigInteger getY(); 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/GOST3410PublicKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.security.PublicKey; 4 | import java.math.BigInteger; 5 | 6 | public interface GOST3410PublicKey extends GOST3410Key, PublicKey 7 | { 8 | 9 | public BigInteger getY(); 10 | } 11 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/serialized/SerializedType.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.serialized; 2 | 3 | import com.ripple.core.fields.Type; 4 | 5 | public interface SerializedType { 6 | Object toJSON(); 7 | byte[] toBytes(); 8 | String toHex(); 9 | void toBytesSink(BytesSink to); 10 | Type type(); 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/ec/ECPairTransform.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.ec; 2 | 3 | import org.ripple.bouncycastle.crypto.CipherParameters; 4 | 5 | public interface ECPairTransform 6 | { 7 | void init(CipherParameters params); 8 | 9 | ECPair transform(ECPair cipherText); 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/ElGamalPrivateKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.math.BigInteger; 4 | import java.security.PrivateKey; 5 | 6 | public interface ElGamalPrivateKey 7 | extends ElGamalKey, PrivateKey 8 | { 9 | public BigInteger getX(); 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/BERApplicationSpecific.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | public class BERApplicationSpecific 4 | extends DERApplicationSpecific 5 | { 6 | public BERApplicationSpecific(int tagNo, ASN1EncodableVector vec) 7 | { 8 | super(tagNo, vec); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsPSKIdentity.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public interface TlsPSKIdentity 4 | { 5 | void skipIdentityHint(); 6 | 7 | void notifyIdentityHint(byte[] psk_identity_hint); 8 | 9 | byte[] getPSKIdentity(); 10 | 11 | byte[] getPSK(); 12 | } 13 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | BTC 5 | CNY 6 | EUR 7 | USD 8 | XRP 9 | YEN 10 | 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/provider/util/AlgorithmProvider.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.provider.util; 2 | 3 | import org.ripple.bouncycastle.jcajce.provider.config.ConfigurableProvider; 4 | 5 | public abstract class AlgorithmProvider 6 | { 7 | public abstract void configure(ConfigurableProvider provider); 8 | } 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/provider/PKIXNameConstraintValidatorException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.provider; 2 | 3 | public class PKIXNameConstraintValidatorException 4 | extends Exception 5 | { 6 | public PKIXNameConstraintValidatorException(String msg) 7 | { 8 | super(msg); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsEncryptionCredentials.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.IOException; 4 | 5 | public interface TlsEncryptionCredentials extends TlsCredentials 6 | { 7 | byte[] decryptPreMasterSecret(byte[] encryptedPreMasterSecret) 8 | throws IOException; 9 | } 10 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/src/main/java/com/ripple/android/Logger.java: -------------------------------------------------------------------------------- 1 | package com.ripple.android; 2 | 3 | import android.util.Log; 4 | 5 | public class Logger { 6 | private static final String LOG_TAG = "RippleApplication"; 7 | 8 | public static void LOG(String s, Object... args) { 9 | Log.d(LOG_TAG, String.format(s, args)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/PreCompInfo.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | /** 4 | * Interface for classes storing precomputation data for multiplication 5 | * algorithms. Used as a Memento (see GOF patterns) by e.g. 6 | * WNafL2RMultiplier. 7 | */ 8 | public interface PreCompInfo 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/ec/ECEncryptor.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.ec; 2 | 3 | import org.ripple.bouncycastle.crypto.CipherParameters; 4 | import org.ripple.bouncycastle.math.ec.ECPoint; 5 | 6 | public interface ECEncryptor 7 | { 8 | void init(CipherParameters params); 9 | 10 | ECPair encrypt(ECPoint point); 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/ec/ECDecryptor.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.ec; 2 | 3 | import org.ripple.bouncycastle.crypto.CipherParameters; 4 | import org.ripple.bouncycastle.math.ec.ECPoint; 5 | 6 | public interface ECDecryptor 7 | { 8 | void init(CipherParameters params); 9 | 10 | ECPoint decrypt(ECPair cipherText); 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/i18n/filter/UntrustedUrlInput.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.i18n.filter; 2 | 3 | /** 4 | * 5 | * Wrapper class to mark an untrusted Url 6 | */ 7 | public class UntrustedUrlInput extends UntrustedInput 8 | { 9 | public UntrustedUrlInput(Object url) 10 | { 11 | super(url); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/ClientAuthenticationType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public class ClientAuthenticationType 4 | { 5 | /* 6 | * RFC 5077 4 7 | */ 8 | public static final short anonymous = 0; 9 | public static final short certificate_based = 1; 10 | public static final short psk = 2; 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/ServerOnlyTlsAuthentication.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public abstract class ServerOnlyTlsAuthentication 4 | implements TlsAuthentication 5 | { 6 | public final TlsCredentials getClientCredentials(CertificateRequest certificateRequest) 7 | { 8 | return null; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/ReferenceMultiplier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class ReferenceMultiplier extends AbstractECMultiplier 6 | { 7 | protected ECPoint multiplyPositive(ECPoint p, BigInteger k) 8 | { 9 | return ECAlgorithms.referenceMultiply(p, k); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/known/tx/txns/OfferCancel.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.known.tx.txns; 2 | 3 | import com.ripple.core.serialized.enums.TransactionType; 4 | import com.ripple.core.types.known.tx.Transaction; 5 | 6 | public class OfferCancel extends Transaction { 7 | public OfferCancel() { 8 | super(TransactionType.OfferCancel); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/known/tx/txns/TicketCreate.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.known.tx.txns; 2 | 3 | import com.ripple.core.serialized.enums.TransactionType; 4 | import com.ripple.core.types.known.tx.Transaction; 5 | 6 | public class TicketCreate extends Transaction { 7 | public TicketCreate() { 8 | super(TransactionType.TicketCreate); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pay One Drop 4 | Login 5 | Pay one drop! 6 | Retrieve wallet 7 | Ripple Payment 8 | 9 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/KeyParser.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | 6 | import org.ripple.bouncycastle.crypto.params.AsymmetricKeyParameter; 7 | 8 | public interface KeyParser 9 | { 10 | AsymmetricKeyParameter readKey(InputStream stream) 11 | throws IOException; 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/SignerInputBuffer.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | 5 | import org.ripple.bouncycastle.crypto.Signer; 6 | 7 | class SignerInputBuffer extends ByteArrayOutputStream 8 | { 9 | void updateSigner(Signer s) 10 | { 11 | s.update(this.buf, 0, count); 12 | } 13 | } -------------------------------------------------------------------------------- /ripple-examples/ripple-android/res/layout/contacts_text_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/DigestInputBuffer.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | 5 | import org.ripple.bouncycastle.crypto.Digest; 6 | 7 | class DigestInputBuffer extends ByteArrayOutputStream 8 | { 9 | void updateDigest(Digest d) 10 | { 11 | d.update(this.buf, 0, count); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ripple-client-transports/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ripple-client/src/main/java/com/ripple/client/transport/TransportEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.transport; 2 | 3 | import org.json.JSONObject; 4 | 5 | public interface TransportEventHandler { 6 | void onMessage(JSONObject msg); 7 | void onConnecting(int attempt); 8 | void onDisconnected(boolean willReconnect); 9 | void onError(Exception error); 10 | void onConnected(); 11 | } 12 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/encodings/common/B64.java: -------------------------------------------------------------------------------- 1 | package com.ripple.encodings.common; 2 | 3 | import org.ripple.bouncycastle.util.encoders.Base64; 4 | 5 | public class B64 { 6 | public static String toString(byte[] bytes) { 7 | return Base64.toBase64String(bytes); 8 | } 9 | public static byte[] decode(String string) { 10 | return Base64.decode(string); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/x509/X509StoreSpi.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.x509; 2 | 3 | import org.ripple.bouncycastle.util.Selector; 4 | 5 | import java.util.Collection; 6 | 7 | public abstract class X509StoreSpi 8 | { 9 | public abstract void engineInit(X509StoreParameters parameters); 10 | 11 | public abstract Collection engineGetMatches(Selector selector); 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1Generator.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.OutputStream; 4 | 5 | public abstract class ASN1Generator 6 | { 7 | protected OutputStream _out; 8 | 9 | public ASN1Generator(OutputStream out) 10 | { 11 | _out = out; 12 | } 13 | 14 | public abstract OutputStream getRawOutputStream(); 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1TaggedObjectParser.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.IOException; 4 | 5 | public interface ASN1TaggedObjectParser 6 | extends ASN1Encodable, InMemoryRepresentable 7 | { 8 | public int getTagNo(); 9 | 10 | public ASN1Encodable getObjectParser(int tag, boolean isExplicit) 11 | throws IOException; 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsSignerCredentials.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.IOException; 4 | 5 | public interface TlsSignerCredentials 6 | extends TlsCredentials 7 | { 8 | byte[] generateCertificateSignature(byte[] hash) 9 | throws IOException; 10 | 11 | SignatureAndHashAlgorithm getSignatureAndHashAlgorithm(); 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1Encodable.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | /** 4 | * Basic interface to produce serialisers for ASN.1 encodings. 5 | */ 6 | public interface ASN1Encodable 7 | { 8 | /** 9 | * Return an object, possibly constructed, of ASN.1 primitives 10 | * @return an ASN.1 primitive. 11 | */ 12 | ASN1Primitive toASN1Primitive(); 13 | } 14 | -------------------------------------------------------------------------------- /ripple-core/src/test/java/com/ripple/core/coretypes/uint/UIntTest.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.coretypes.uint; 2 | 3 | import org.junit.Test; 4 | 5 | import static junit.framework.TestCase.assertTrue; 6 | 7 | public class UIntTest { 8 | @Test 9 | public void testLTE() throws Exception { 10 | UInt64 n = new UInt64(34); 11 | UInt32 n2 = new UInt32(400); 12 | assertTrue(n.lte(n2)); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/MacDerivationFunction.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * base interface for general purpose Mac based byte derivation functions. 5 | */ 6 | public interface MacDerivationFunction 7 | extends DerivationFunction 8 | { 9 | /** 10 | * return the MAC used as the basis for the function 11 | */ 12 | public Mac getMac(); 13 | } 14 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/BCKeyStore.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.security.SecureRandom; 4 | 5 | /** 6 | * all BC provider keystores implement this interface. 7 | */ 8 | public interface BCKeyStore 9 | { 10 | /** 11 | * set the random source for the key store 12 | */ 13 | public void setRandom(SecureRandom random); 14 | } 15 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/utils/Utils.java: -------------------------------------------------------------------------------- 1 | package com.ripple.utils; 2 | 3 | import com.ripple.encodings.common.B16; 4 | 5 | import java.math.BigInteger; 6 | 7 | public class Utils { 8 | public static String bigHex(BigInteger bn) { 9 | return B16.toStringTrimmed(bn.toByteArray()); 10 | } 11 | public static BigInteger uBigInt(byte[] bytes) { 12 | return new BigInteger(1, bytes); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/StoreException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | public class StoreException 4 | extends RuntimeException 5 | { 6 | private Throwable _e; 7 | 8 | public StoreException(String s, Throwable e) 9 | { 10 | super(s); 11 | _e = e; 12 | } 13 | 14 | public Throwable getCause() 15 | { 16 | return _e; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/io/StreamOverflowException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.io; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Exception thrown when too much data is written to an InputStream 7 | */ 8 | public class StreamOverflowException 9 | extends IOException 10 | { 11 | public StreamOverflowException(String msg) 12 | { 13 | super(msg); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/provider/asymmetric/util/DSAEncoder.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.provider.asymmetric.util; 2 | 3 | import java.io.IOException; 4 | import java.math.BigInteger; 5 | 6 | public interface DSAEncoder 7 | { 8 | byte[] encode(BigInteger r, BigInteger s) 9 | throws IOException; 10 | 11 | BigInteger[] decode(byte[] sig) 12 | throws IOException; 13 | } 14 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/provider/config/ProviderConfiguration.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.provider.config; 2 | 3 | import javax.crypto.spec.DHParameterSpec; 4 | 5 | import org.ripple.bouncycastle.jce.spec.ECParameterSpec; 6 | 7 | public interface ProviderConfiguration 8 | { 9 | ECParameterSpec getEcImplicitlyCa(); 10 | 11 | DHParameterSpec getDHDefaultParameters(int keySize); 12 | } 13 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/shamap/ShaMapItem.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.shamap; 2 | 3 | import com.ripple.core.coretypes.hash.prefixes.Prefix; 4 | import com.ripple.core.serialized.BytesSink; 5 | 6 | abstract public class ShaMapItem { 7 | abstract void toBytesSink(BytesSink sink); 8 | public abstract ShaMapItem copy(); 9 | public abstract T value(); 10 | public abstract Prefix hashPrefix(); 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/ExtendedDigest.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | public interface ExtendedDigest 4 | extends Digest 5 | { 6 | /** 7 | * Return the size in bytes of the internal buffer the digest applies it's compression 8 | * function to. 9 | * 10 | * @return byte length of the digests internal buffer. 11 | */ 12 | public int getByteLength(); 13 | } 14 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsAgreementCredentials.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.IOException; 4 | 5 | import org.ripple.bouncycastle.crypto.params.AsymmetricKeyParameter; 6 | 7 | public interface TlsAgreementCredentials 8 | extends TlsCredentials 9 | { 10 | byte[] generateAgreement(AsymmetricKeyParameter peerPublicKey) 11 | throws IOException; 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/ScaleXPointMap.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | public class ScaleXPointMap implements ECPointMap 4 | { 5 | protected final ECFieldElement scale; 6 | 7 | public ScaleXPointMap(ECFieldElement scale) 8 | { 9 | this.scale = scale; 10 | } 11 | 12 | public ECPoint map(ECPoint p) 13 | { 14 | return p.scaleX(scale); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/ScaleYPointMap.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | public class ScaleYPointMap implements ECPointMap 4 | { 5 | protected final ECFieldElement scale; 6 | 7 | public ScaleYPointMap(ECFieldElement scale) 8 | { 9 | this.scale = scale; 10 | } 11 | 12 | public ECPoint map(ECPoint p) 13 | { 14 | return p.scaleY(scale); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ripple-client/src/main/java/com/ripple/client/async/Composed2.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.async; 2 | 3 | abstract public class Composed2 extends ComposedOperation { 4 | @Override 5 | protected int numOps() { 6 | return 2; 7 | } 8 | 9 | @Override 10 | protected void finished() { 11 | on2(first, second); 12 | } 13 | 14 | public abstract void on2(T1 first, T2 second); 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/DerivationFunction.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * base interface for general purpose byte derivation functions. 5 | */ 6 | public interface DerivationFunction 7 | { 8 | public void init(DerivationParameters param); 9 | 10 | public int generateBytes(byte[] out, int outOff, int len) 11 | throws DataLengthException, IllegalArgumentException; 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/ECPointFormat.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 4492 5.1.2 5 | */ 6 | public class ECPointFormat 7 | { 8 | public static final short uncompressed = 0; 9 | public static final short ansiX962_compressed_prime = 1; 10 | public static final short ansiX962_compressed_char2 = 2; 11 | 12 | /* 13 | * reserved (248..255) 14 | */ 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/DigestDerivationFunction.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * base interface for general purpose Digest based byte derivation functions. 5 | */ 6 | public interface DigestDerivationFunction 7 | extends DerivationFunction 8 | { 9 | /** 10 | * return the message digest used as the basis for the function 11 | */ 12 | public Digest getDigest(); 13 | } 14 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/SignatureAlgorithm.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 5246 7.4.1.4.1 (in RFC 2246, there were no specific values assigned) 5 | */ 6 | public class SignatureAlgorithm 7 | { 8 | public static final short anonymous = 0; 9 | public static final short rsa = 1; 10 | public static final short dsa = 2; 11 | public static final short ecdsa = 3; 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/ECPrivateKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.math.BigInteger; 4 | import java.security.PrivateKey; 5 | 6 | /** 7 | * interface for Elliptic Curve Private keys. 8 | */ 9 | public interface ECPrivateKey 10 | extends ECKey, PrivateKey 11 | { 12 | /** 13 | * return the private value D. 14 | */ 15 | public BigInteger getD(); 16 | } 17 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/StreamParsingException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | public class StreamParsingException 4 | extends Exception 5 | { 6 | Throwable _e; 7 | 8 | public StreamParsingException(String message, Throwable e) 9 | { 10 | super(message); 11 | _e = e; 12 | } 13 | 14 | public Throwable getCause() 15 | { 16 | return _e; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-client/src/main/java/com/ripple/client/async/Composed3.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.async; 2 | 3 | abstract public class Composed3 extends ComposedOperation { 4 | @Override 5 | protected int numOps() { 6 | return 3; 7 | } 8 | 9 | @Override 10 | protected void finished() { 11 | on3(first, second, third); 12 | } 13 | 14 | abstract void on3(T1 first, T2 second, T3 third); 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/ConnectionEnd.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 2246 5 | *

6 | * Note that the values here are implementation-specific and arbitrary. It is recommended not to 7 | * depend on the particular values (e.g. serialization). 8 | */ 9 | public class ConnectionEnd 10 | { 11 | public static final int server = 0; 12 | public static final int client = 1; 13 | } 14 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/ContentType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 2246 6.2.1 5 | */ 6 | public class ContentType 7 | { 8 | public static final short change_cipher_spec = 20; 9 | public static final short alert = 21; 10 | public static final short handshake = 22; 11 | public static final short application_data = 23; 12 | public static final short heartbeat = 24; 13 | } 14 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/x509/util/StreamParsingException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.x509.util; 2 | 3 | public class StreamParsingException 4 | extends Exception 5 | { 6 | Throwable _e; 7 | 8 | public StreamParsingException(String message, Throwable e) 9 | { 10 | super(message); 11 | _e = e; 12 | } 13 | 14 | public Throwable getCause() 15 | { 16 | return _e; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsCipherFactory.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.IOException; 4 | 5 | public interface TlsCipherFactory 6 | { 7 | /** 8 | * See enumeration classes EncryptionAlgorithm, MACAlgorithm for appropriate argument values 9 | */ 10 | TlsCipher createCipher(TlsContext context, int encryptionAlgorithm, int macAlgorithm) 11 | throws IOException; 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/ECPublicKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.security.PublicKey; 4 | 5 | import org.ripple.bouncycastle.math.ec.ECPoint; 6 | 7 | /** 8 | * interface for elliptic curve public keys. 9 | */ 10 | public interface ECPublicKey 11 | extends ECKey, PublicKey 12 | { 13 | /** 14 | * return the public point Q 15 | */ 16 | public ECPoint getQ(); 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/math/ntru/polynomial/Constants.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.math.ntru.polynomial; 2 | 3 | import java.math.BigDecimal; 4 | import java.math.BigInteger; 5 | 6 | public class Constants 7 | { 8 | static final BigInteger BIGINT_ZERO = BigInteger.valueOf(0); 9 | static final BigInteger BIGINT_ONE = BigInteger.valueOf(1); 10 | 11 | static final BigDecimal BIGDEC_ONE = BigDecimal.valueOf(1); 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/ec/ECPairFactorTransform.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.ec; 2 | 3 | import java.math.BigInteger; 4 | 5 | public interface ECPairFactorTransform 6 | extends ECPairTransform 7 | { 8 | /** 9 | * Return the last value used to calculated a transform. 10 | * 11 | * @return a BigInteger representing the last transform value used. 12 | */ 13 | BigInteger getTransformValue(); 14 | } 15 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsNullCompression.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.OutputStream; 4 | 5 | public class TlsNullCompression 6 | implements TlsCompression 7 | { 8 | public OutputStream compress(OutputStream output) 9 | { 10 | return output; 11 | } 12 | 13 | public OutputStream decompress(OutputStream output) 14 | { 15 | return output; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/test/TestFailedException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.test; 2 | 3 | public class TestFailedException 4 | extends RuntimeException 5 | { 6 | private TestResult _result; 7 | 8 | public TestFailedException( 9 | TestResult result) 10 | { 11 | _result = result; 12 | } 13 | 14 | public TestResult getResult() 15 | { 16 | return _result; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/crypto/ecdsa/IKeyPair.java: -------------------------------------------------------------------------------- 1 | package com.ripple.crypto.ecdsa; 2 | 3 | import java.math.BigInteger; 4 | 5 | public interface IKeyPair { 6 | String canonicalPubHex(); 7 | byte[] canonicalPubBytes(); 8 | 9 | BigInteger pub(); 10 | BigInteger priv(); 11 | String privHex(); 12 | 13 | boolean verifySignature(byte[] message, byte[] sigBytes); 14 | byte[] signMessage(byte[] message); 15 | 16 | byte[] pub160Hash(); 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/CertChainType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /* 4 | * RFC 3546 3.3. 5 | */ 6 | public class CertChainType 7 | { 8 | public static final short individual_certs = 0; 9 | public static final short pkipath = 1; 10 | 11 | public static boolean isValid(short certChainType) 12 | { 13 | return certChainType >= individual_certs && certChainType <= pkipath; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/ECKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import org.ripple.bouncycastle.jce.spec.ECParameterSpec; 4 | 5 | /** 6 | * generic interface for an Elliptic Curve Key. 7 | */ 8 | public interface ECKey 9 | { 10 | /** 11 | * return a parameter specification representing the EC domain parameters 12 | * for the key. 13 | */ 14 | public ECParameterSpec getParameters(); 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/Iterable.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | import java.util.Iterator; 4 | 5 | /** 6 | * Utility class to allow use of Iterable feature in JDK 1.5+ 7 | */ 8 | public interface Iterable 9 | extends java.lang.Iterable 10 | { 11 | /** 12 | * Returns an iterator over a set of elements of type T. 13 | * 14 | * @return an Iterator. 15 | */ 16 | Iterator iterator(); 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/AbstractTlsCipherFactory.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.IOException; 4 | 5 | public class AbstractTlsCipherFactory 6 | implements TlsCipherFactory 7 | { 8 | public TlsCipher createCipher(TlsContext context, int encryptionAlgorithm, int macAlgorithm) 9 | throws IOException 10 | { 11 | throw new TlsFatalAlert(AlertDescription.internal_error); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/AbstractTlsSignerCredentials.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public abstract class AbstractTlsSignerCredentials 4 | extends AbstractTlsCredentials 5 | implements TlsSignerCredentials 6 | { 7 | public SignatureAndHashAlgorithm getSignatureAndHashAlgorithm() 8 | { 9 | throw new IllegalStateException("TlsSignerCredentials implementation does not support (D)TLS 1.2+"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/io/pem/PemObjectGenerator.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.io.pem; 2 | 3 | /** 4 | * Base interface for generators of PEM objects. 5 | */ 6 | public interface PemObjectGenerator 7 | { 8 | /** 9 | * Generate a PEM object. 10 | * 11 | * @return the generated object. 12 | * @throws PemGenerationException on failure. 13 | */ 14 | PemObject generate() 15 | throws PemGenerationException; 16 | } 17 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/x9/X9ECParametersHolder.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.x9; 2 | 3 | public abstract class X9ECParametersHolder 4 | { 5 | private X9ECParameters params; 6 | 7 | public X9ECParameters getParameters() 8 | { 9 | if (params == null) 10 | { 11 | params = createParameters(); 12 | } 13 | 14 | return params; 15 | } 16 | 17 | protected abstract X9ECParameters createParameters(); 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/SRTPProtectionProfile.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public class SRTPProtectionProfile 4 | { 5 | /* 6 | * RFC 5764 4.1.2. 7 | */ 8 | public static final int SRTP_AES128_CM_HMAC_SHA1_80 = 0x0001; 9 | public static final int SRTP_AES128_CM_HMAC_SHA1_32 = 0x0002; 10 | public static final int SRTP_NULL_HMAC_SHA1_80 = 0x0005; 11 | public static final int SRTP_NULL_HMAC_SHA1_32 = 0x0006; 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/CompressionMethod.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 2246 6.1 5 | */ 6 | public class CompressionMethod 7 | { 8 | public static final short _null = 0; 9 | 10 | /* 11 | * RFC 3749 2 12 | */ 13 | public static final short DEFLATE = 1; 14 | 15 | /* 16 | * Values from 224 decimal (0xE0) through 255 decimal (0xFF) 17 | * inclusive are reserved for private use. 18 | */ 19 | } 20 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/provider/ExtCRLException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.provider; 2 | 3 | import java.security.cert.CRLException; 4 | 5 | class ExtCRLException 6 | extends CRLException 7 | { 8 | Throwable cause; 9 | 10 | ExtCRLException(String message, Throwable cause) 11 | { 12 | super(message); 13 | this.cause = cause; 14 | } 15 | 16 | public Throwable getCause() 17 | { 18 | return cause; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DERBoolean.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | /** 4 | * @deprecated use ASN1Boolean 5 | */ 6 | public class DERBoolean 7 | extends ASN1Boolean 8 | { 9 | /** 10 | * @deprecated use getInstance(boolean) method. 11 | * @param value 12 | */ 13 | public DERBoolean(boolean value) 14 | { 15 | super(value); 16 | } 17 | 18 | DERBoolean(byte[] value) 19 | { 20 | super(value); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/ECBasisType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 4492 5.4. (Errata ID: 2389) 5 | */ 6 | public class ECBasisType 7 | { 8 | public static final short ec_basis_trinomial = 1; 9 | public static final short ec_basis_pentanomial = 2; 10 | 11 | public static boolean isValid(short ecBasisType) 12 | { 13 | return ecBasisType >= ec_basis_trinomial && ecBasisType <= ec_basis_pentanomial; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/HeartbeatMode.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /* 4 | * RFC 6520 5 | */ 6 | public class HeartbeatMode 7 | { 8 | public static final short peer_allowed_to_send = 1; 9 | public static final short peer_not_allowed_to_send = 2; 10 | 11 | public static boolean isValid(short heartbeatMode) 12 | { 13 | return heartbeatMode >= peer_allowed_to_send && heartbeatMode <= peer_not_allowed_to_send; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/GOST3410Params.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import org.ripple.bouncycastle.jce.spec.GOST3410PublicKeyParameterSetSpec; 4 | 5 | public interface GOST3410Params 6 | { 7 | 8 | public String getPublicKeyParamSetOID(); 9 | 10 | public String getDigestParamSetOID(); 11 | 12 | public String getEncryptionParamSetOID(); 13 | 14 | public GOST3410PublicKeyParameterSetSpec getPublicKeyParameters(); 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/spec/ElGamalKeySpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.spec; 2 | 3 | import java.security.spec.KeySpec; 4 | 5 | public class ElGamalKeySpec 6 | implements KeySpec 7 | { 8 | private ElGamalParameterSpec spec; 9 | 10 | public ElGamalKeySpec( 11 | ElGamalParameterSpec spec) 12 | { 13 | this.spec = spec; 14 | } 15 | 16 | public ElGamalParameterSpec getParams() 17 | { 18 | return spec; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsCipher.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.IOException; 4 | 5 | public interface TlsCipher 6 | { 7 | int getPlaintextLimit(int ciphertextLimit); 8 | 9 | byte[] encodePlaintext(long seqNo, short type, byte[] plaintext, int offset, int len) 10 | throws IOException; 11 | 12 | byte[] decodeCiphertext(long seqNo, short type, byte[] ciphertext, int offset, int len) 13 | throws IOException; 14 | } 15 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/i18n/filter/TrustedInput.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.i18n.filter; 2 | 3 | public class TrustedInput 4 | { 5 | 6 | protected Object input; 7 | 8 | public TrustedInput(Object input) 9 | { 10 | this.input = input; 11 | } 12 | 13 | public Object getInput() 14 | { 15 | return input; 16 | } 17 | 18 | public String toString() 19 | { 20 | return input.toString(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/misc/NetscapeRevocationURL.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.misc; 2 | 3 | import org.ripple.bouncycastle.asn1.DERIA5String; 4 | 5 | public class NetscapeRevocationURL 6 | extends DERIA5String 7 | { 8 | public NetscapeRevocationURL( 9 | DERIA5String str) 10 | { 11 | super(str.getString()); 12 | } 13 | 14 | public String toString() 15 | { 16 | return "NetscapeRevocationURL: " + this.getString(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/misc/VerisignCzagExtension.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.misc; 2 | 3 | import org.ripple.bouncycastle.asn1.DERIA5String; 4 | 5 | public class VerisignCzagExtension 6 | extends DERIA5String 7 | { 8 | public VerisignCzagExtension( 9 | DERIA5String str) 10 | { 11 | super(str.getString()); 12 | } 13 | 14 | public String toString() 15 | { 16 | return "VerisignCzagExtension: " + this.getString(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/modes/gcm/BasicGCMMultiplier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.modes.gcm; 2 | 3 | public class BasicGCMMultiplier implements GCMMultiplier 4 | { 5 | private int[] H; 6 | 7 | public void init(byte[] H) 8 | { 9 | this.H = GCMUtil.asInts(H); 10 | } 11 | 12 | public void multiplyH(byte[] x) 13 | { 14 | int[] t = GCMUtil.asInts(x); 15 | GCMUtil.multiply(t, H); 16 | GCMUtil.asBytes(t, x); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/serialized/MultiSink.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.serialized; 2 | 3 | public class MultiSink implements BytesSink { 4 | final private BytesSink[] sinks; 5 | public MultiSink(BytesSink... sinks) { 6 | this.sinks = sinks; 7 | } 8 | @Override 9 | public void add(byte b) { 10 | for (BytesSink sink : sinks) sink.add(b); 11 | } 12 | @Override 13 | public void add(byte[] b) { 14 | for (BytesSink sink : sinks) sink.add(b); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/engines/SEEDWrapEngine.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.engines; 2 | 3 | /** 4 | * An implementation of the SEED key wrapper based on RFC 4010/RFC 3394. 5 | *

6 | * For further details see: http://www.ietf.org/rfc/rfc4010.txt. 7 | */ 8 | public class SEEDWrapEngine 9 | extends RFC3394WrapEngine 10 | { 11 | public SEEDWrapEngine() 12 | { 13 | super(new SEEDEngine()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/HashAlgorithm.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 5246 7.4.1.4.1 5 | */ 6 | public class HashAlgorithm 7 | { 8 | public static final short none = 0; 9 | public static final short md5 = 1; 10 | public static final short sha1 = 2; 11 | public static final short sha224 = 3; 12 | public static final short sha256 = 4; 13 | public static final short sha384 = 5; 14 | public static final short sha512 = 6; 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/PKIXCRLStore.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce; 2 | 3 | import java.security.cert.CRL; 4 | import java.util.Collection; 5 | 6 | import org.ripple.bouncycastle.util.Selector; 7 | import org.ripple.bouncycastle.util.Store; 8 | import org.ripple.bouncycastle.util.StoreException; 9 | 10 | public interface PKIXCRLStore 11 | extends Store 12 | { 13 | Collection getMatches(Selector selector) 14 | throws StoreException; 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/HeartbeatMessageType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /* 4 | * RFC 6520 3. 5 | */ 6 | public class HeartbeatMessageType 7 | { 8 | public static final short heartbeat_request = 1; 9 | public static final short heartbeat_response = 2; 10 | 11 | public static boolean isValid(short heartbeatMessageType) 12 | { 13 | return heartbeatMessageType >= heartbeat_request && heartbeatMessageType <= heartbeat_response; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/smime/SMIMEAttributes.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.smime; 2 | 3 | import org.ripple.bouncycastle.asn1.ASN1ObjectIdentifier; 4 | import org.ripple.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; 5 | 6 | public interface SMIMEAttributes 7 | { 8 | public static final ASN1ObjectIdentifier smimeCapabilities = PKCSObjectIdentifiers.pkcs_9_at_smimeCapabilities; 9 | public static final ASN1ObjectIdentifier encrypKeyPref = PKCSObjectIdentifiers.id_aa_encrypKeyPref; 10 | } 11 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/Integers.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | public class Integers 4 | { 5 | public static int rotateLeft(int i, int distance) 6 | { 7 | return Integer.rotateLeft(i, distance); 8 | } 9 | 10 | public static int rotateRight(int i, int distance) 11 | { 12 | return Integer.rotateRight(i, distance); 13 | } 14 | 15 | public static Integer valueOf(int value) 16 | { 17 | return Integer.valueOf(value); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/InMemoryRepresentable.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Interface implemented by objects that can be converted from streaming to in-memory objects. 7 | */ 8 | public interface InMemoryRepresentable 9 | { 10 | /** 11 | * Get the in-memory representation of the ASN.1 object. 12 | * @throws IOException for bad input data. 13 | */ 14 | ASN1Primitive getLoadedObject() 15 | throws IOException; 16 | } 17 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/PKIXCertStore.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce; 2 | 3 | import java.security.cert.Certificate; 4 | import java.util.Collection; 5 | 6 | import org.ripple.bouncycastle.util.Selector; 7 | import org.ripple.bouncycastle.util.Store; 8 | import org.ripple.bouncycastle.util.StoreException; 9 | 10 | public interface PKIXCertStore 11 | extends Store 12 | { 13 | Collection getMatches(Selector selector) 14 | throws StoreException; 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/ECConstants.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | import java.math.BigInteger; 4 | 5 | public interface ECConstants 6 | { 7 | public static final BigInteger ZERO = BigInteger.valueOf(0); 8 | public static final BigInteger ONE = BigInteger.valueOf(1); 9 | public static final BigInteger TWO = BigInteger.valueOf(2); 10 | public static final BigInteger THREE = BigInteger.valueOf(3); 11 | public static final BigInteger FOUR = BigInteger.valueOf(4); 12 | } 13 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1Encoding.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | /** 4 | * Supported encoding formats. 5 | */ 6 | public interface ASN1Encoding 7 | { 8 | /** 9 | * DER - distinguished encoding rules. 10 | */ 11 | static final String DER = "DER"; 12 | 13 | /** 14 | * DL - definite length encoding. 15 | */ 16 | static final String DL = "DL"; 17 | 18 | /** 19 | * BER - basic encoding rules. 20 | */ 21 | static final String BER = "BER"; 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/engines/CamelliaWrapEngine.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.engines; 2 | 3 | /** 4 | * An implementation of the Camellia key wrapper based on RFC 3657/RFC 3394. 5 | *

6 | * For further details see: http://www.ietf.org/rfc/rfc3657.txt. 7 | */ 8 | public class CamelliaWrapEngine 9 | extends RFC3394WrapEngine 10 | { 11 | public CamelliaWrapEngine() 12 | { 13 | super(new CamelliaEngine()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/CipherType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 2246 5 | *

6 | * Note that the values here are implementation-specific and arbitrary. It is recommended not to 7 | * depend on the particular values (e.g. serialization). 8 | */ 9 | public class CipherType 10 | { 11 | public static final int stream = 0; 12 | public static final int block = 1; 13 | 14 | /* 15 | * RFC 5246 16 | */ 17 | public static final int aead = 2; 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsClientContextImpl.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.security.SecureRandom; 4 | 5 | class TlsClientContextImpl 6 | extends AbstractTlsContext 7 | implements TlsClientContext 8 | { 9 | TlsClientContextImpl(SecureRandom secureRandom, SecurityParameters securityParameters) 10 | { 11 | super(secureRandom, securityParameters); 12 | } 13 | 14 | public boolean isServer() 15 | { 16 | return false; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsServerContextImpl.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.security.SecureRandom; 4 | 5 | class TlsServerContextImpl 6 | extends AbstractTlsContext 7 | implements TlsServerContext 8 | { 9 | TlsServerContextImpl(SecureRandom secureRandom, SecurityParameters securityParameters) 10 | { 11 | super(secureRandom, securityParameters); 12 | } 13 | 14 | public boolean isServer() 15 | { 16 | return true; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/provider/asymmetric/x509/ExtCRLException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.provider.asymmetric.x509; 2 | 3 | import java.security.cert.CRLException; 4 | 5 | class ExtCRLException 6 | extends CRLException 7 | { 8 | Throwable cause; 9 | 10 | ExtCRLException(String message, Throwable cause) 11 | { 12 | super(message); 13 | this.cause = cause; 14 | } 15 | 16 | public Throwable getCause() 17 | { 18 | return cause; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/exception/ExtIOException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.exception; 2 | 3 | import java.io.IOException; 4 | 5 | public class ExtIOException 6 | extends IOException 7 | implements ExtException 8 | { 9 | private Throwable cause; 10 | 11 | public ExtIOException(String message, Throwable cause) 12 | { 13 | super(message); 14 | this.cause = cause; 15 | } 16 | 17 | public Throwable getCause() 18 | { 19 | return cause; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/eac/CertificationAuthorityReference.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.eac; 2 | 3 | public class CertificationAuthorityReference 4 | extends CertificateHolderReference 5 | { 6 | public CertificationAuthorityReference(String countryCode, String holderMnemonic, String sequenceNumber) 7 | { 8 | super(countryCode, holderMnemonic, sequenceNumber); 9 | } 10 | 11 | CertificationAuthorityReference(byte[] contents) 12 | { 13 | super(contents); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/MQVPublicKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.security.PublicKey; 4 | 5 | /** 6 | * Static/ephemeral public key pair for use with ECMQV key agreement 7 | */ 8 | public interface MQVPublicKey 9 | extends PublicKey 10 | { 11 | /** 12 | * return the static public key. 13 | */ 14 | PublicKey getStaticKey(); 15 | 16 | /** 17 | * return the ephemeral public key. 18 | */ 19 | PublicKey getEphemeralKey(); 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1OctetStringParser.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.InputStream; 4 | 5 | /** 6 | * A basic parser for an OCTET STRING object 7 | */ 8 | public interface ASN1OctetStringParser 9 | extends ASN1Encodable, InMemoryRepresentable 10 | { 11 | /** 12 | * Return the content of the OCTET STRING as an InputStream. 13 | * 14 | * @return an InputStream representing the OCTET STRING's content. 15 | */ 16 | public InputStream getOctetStream(); 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DEREncodableVector.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | /** 4 | * a general class for building up a vector of DER encodable objects - 5 | * this will eventually be superceded by ASN1EncodableVector so you should 6 | * use that class in preference. 7 | */ 8 | public class DEREncodableVector 9 | extends ASN1EncodableVector 10 | { 11 | /** 12 | * @deprecated use ASN1EncodableVector instead. 13 | */ 14 | public DEREncodableVector() 15 | { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/AsymmetricKeyParameter.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import org.ripple.bouncycastle.crypto.CipherParameters; 4 | 5 | public class AsymmetricKeyParameter 6 | implements CipherParameters 7 | { 8 | boolean privateKey; 9 | 10 | public AsymmetricKeyParameter( 11 | boolean privateKey) 12 | { 13 | this.privateKey = privateKey; 14 | } 15 | 16 | public boolean isPrivate() 17 | { 18 | return privateKey; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/SRP6GroupParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class SRP6GroupParameters 6 | { 7 | private BigInteger N, g; 8 | 9 | public SRP6GroupParameters(BigInteger N, BigInteger g) 10 | { 11 | this.N = N; 12 | this.g = g; 13 | } 14 | 15 | public BigInteger getG() 16 | { 17 | return g; 18 | } 19 | 20 | public BigInteger getN() 21 | { 22 | return N; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/ECPrivateKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class ECPrivateKeyParameters 6 | extends ECKeyParameters 7 | { 8 | BigInteger d; 9 | 10 | public ECPrivateKeyParameters( 11 | BigInteger d, 12 | ECDomainParameters params) 13 | { 14 | super(true, params); 15 | this.d = d; 16 | } 17 | 18 | public BigInteger getD() 19 | { 20 | return d; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/BERFactory.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | class BERFactory 4 | { 5 | static final BERSequence EMPTY_SEQUENCE = new BERSequence(); 6 | static final BERSet EMPTY_SET = new BERSet(); 7 | 8 | static BERSequence createSequence(ASN1EncodableVector v) 9 | { 10 | return v.size() < 1 ? EMPTY_SEQUENCE : new BERSequence(v); 11 | } 12 | 13 | static BERSet createSet(ASN1EncodableVector v) 14 | { 15 | return v.size() < 1 ? EMPTY_SET : new BERSet(v); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DERFactory.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | class DERFactory 4 | { 5 | static final ASN1Sequence EMPTY_SEQUENCE = new DERSequence(); 6 | static final ASN1Set EMPTY_SET = new DERSet(); 7 | 8 | static ASN1Sequence createSequence(ASN1EncodableVector v) 9 | { 10 | return v.size() < 1 ? EMPTY_SEQUENCE : new DLSequence(v); 11 | } 12 | 13 | static ASN1Set createSet(ASN1EncodableVector v) 14 | { 15 | return v.size() < 1 ? EMPTY_SET : new DLSet(v); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DERUTCTime.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * DER UTC time object. 7 | */ 8 | public class DERUTCTime 9 | extends ASN1UTCTime 10 | { 11 | DERUTCTime(byte[] bytes) 12 | { 13 | super(bytes); 14 | } 15 | 16 | public DERUTCTime(Date time) 17 | { 18 | super(time); 19 | } 20 | 21 | public DERUTCTime(String time) 22 | { 23 | super(time); 24 | } 25 | 26 | // TODO: create proper DER encoding. 27 | } 28 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/DSAKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | public class DSAKeyParameters 4 | extends AsymmetricKeyParameter 5 | { 6 | private DSAParameters params; 7 | 8 | public DSAKeyParameters( 9 | boolean isPrivate, 10 | DSAParameters params) 11 | { 12 | super(isPrivate); 13 | 14 | this.params = params; 15 | } 16 | 17 | public DSAParameters getParameters() 18 | { 19 | return params; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/ECKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | public class ECKeyParameters 4 | extends AsymmetricKeyParameter 5 | { 6 | ECDomainParameters params; 7 | 8 | protected ECKeyParameters( 9 | boolean isPrivate, 10 | ECDomainParameters params) 11 | { 12 | super(isPrivate); 13 | 14 | this.params = params; 15 | } 16 | 17 | public ECDomainParameters getParameters() 18 | { 19 | return params; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/x509/ExtCertificateEncodingException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.x509; 2 | 3 | import java.security.cert.CertificateEncodingException; 4 | 5 | class ExtCertificateEncodingException 6 | extends CertificateEncodingException 7 | { 8 | Throwable cause; 9 | 10 | ExtCertificateEncodingException(String message, Throwable cause) 11 | { 12 | super(message); 13 | this.cause = cause; 14 | } 15 | 16 | public Throwable getCause() 17 | { 18 | return cause; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsSRPGroupVerifier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import org.ripple.bouncycastle.crypto.params.SRP6GroupParameters; 4 | 5 | public interface TlsSRPGroupVerifier 6 | { 7 | /** 8 | * Check whether the given SRP group parameters are acceptable for use. 9 | * 10 | * @param group the {@link SRP6GroupParameters} to check 11 | * @return true if (and only if) the specified group parameters are acceptable 12 | */ 13 | boolean accept(SRP6GroupParameters group); 14 | } 15 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1Exception.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.IOException; 4 | 5 | public class ASN1Exception 6 | extends IOException 7 | { 8 | private Throwable cause; 9 | 10 | ASN1Exception(String message) 11 | { 12 | super(message); 13 | } 14 | 15 | ASN1Exception(String message, Throwable cause) 16 | { 17 | super(message); 18 | this.cause = cause; 19 | } 20 | 21 | public Throwable getCause() 22 | { 23 | return cause; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/MaxFragmentLength.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public class MaxFragmentLength 4 | { 5 | /* 6 | * RFC 3546 3.2. 7 | */ 8 | public static final short pow2_9 = 1; 9 | public static final short pow2_10 = 2; 10 | public static final short pow2_11 = 3; 11 | public static final short pow2_12 = 4; 12 | 13 | public static boolean isValid(short maxFragmentLength) 14 | { 15 | return maxFragmentLength >= pow2_9 && maxFragmentLength <= pow2_12; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/SupplementalDataEntry.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public class SupplementalDataEntry 4 | { 5 | protected int dataType; 6 | protected byte[] data; 7 | 8 | public SupplementalDataEntry(int dataType, byte[] data) 9 | { 10 | this.dataType = dataType; 11 | this.data = data; 12 | } 13 | 14 | public int getDataType() 15 | { 16 | return dataType; 17 | } 18 | 19 | public byte[] getData() 20 | { 21 | return data; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/DSAPrivateKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class DSAPrivateKeyParameters 6 | extends DSAKeyParameters 7 | { 8 | private BigInteger x; 9 | 10 | public DSAPrivateKeyParameters( 11 | BigInteger x, 12 | DSAParameters params) 13 | { 14 | super(true, params); 15 | 16 | this.x = x; 17 | } 18 | 19 | public BigInteger getX() 20 | { 21 | return x; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/DSAPublicKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class DSAPublicKeyParameters 6 | extends DSAKeyParameters 7 | { 8 | private BigInteger y; 9 | 10 | public DSAPublicKeyParameters( 11 | BigInteger y, 12 | DSAParameters params) 13 | { 14 | super(false, params); 15 | 16 | this.y = y; 17 | } 18 | 19 | public BigInteger getY() 20 | { 21 | return y; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/ECPublicKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import org.ripple.bouncycastle.math.ec.ECPoint; 4 | 5 | public class ECPublicKeyParameters 6 | extends ECKeyParameters 7 | { 8 | ECPoint Q; 9 | 10 | public ECPublicKeyParameters( 11 | ECPoint Q, 12 | ECDomainParameters params) 13 | { 14 | super(false, params); 15 | this.Q = Q.normalize(); 16 | } 17 | 18 | public ECPoint getQ() 19 | { 20 | return Q; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/TlsHandshakeHash.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import org.ripple.bouncycastle.crypto.Digest; 4 | 5 | public interface TlsHandshakeHash 6 | extends Digest 7 | { 8 | void init(TlsContext context); 9 | 10 | TlsHandshakeHash notifyPRFDetermined(); 11 | 12 | void trackHashAlgorithm(short hashAlgorithm); 13 | 14 | void sealHashAlgorithms(); 15 | 16 | TlsHandshakeHash stopTracking(); 17 | 18 | Digest forkPRFHash(); 19 | 20 | byte[] getFinalHash(short hashAlgorithm); 21 | } 22 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/src/main/java/com/ripple/android/RippleApplication.java: -------------------------------------------------------------------------------- 1 | 2 | package com.ripple.android; 3 | 4 | import android.app.Application; 5 | import com.ripple.android.client.AndroidClient; 6 | 7 | public class RippleApplication extends Application { 8 | public AndroidClient client; 9 | public AndroidClient getClient() { 10 | return client; 11 | } 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | client = new AndroidClient(); 17 | client.connect("wss://s-east.ripple.com"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1ParsingException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | public class ASN1ParsingException 4 | extends IllegalStateException 5 | { 6 | private Throwable cause; 7 | 8 | public ASN1ParsingException(String message) 9 | { 10 | super(message); 11 | } 12 | 13 | public ASN1ParsingException(String message, Throwable cause) 14 | { 15 | super(message); 16 | this.cause = cause; 17 | } 18 | 19 | public Throwable getCause() 20 | { 21 | return cause; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/x509/qualified/RFC3739QCObjectIdentifiers.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.x509.qualified; 2 | 3 | import org.ripple.bouncycastle.asn1.ASN1ObjectIdentifier; 4 | 5 | public interface RFC3739QCObjectIdentifiers 6 | { 7 | /** OID: 1.3.6.1.5.5.7.11.1 */ 8 | static final ASN1ObjectIdentifier id_qcs_pkixQCSyntax_v1 = new ASN1ObjectIdentifier("1.3.6.1.5.5.7.11.1"); 9 | /** OID: 1.3.6.1.5.5.7.11.2 */ 10 | static final ASN1ObjectIdentifier id_qcs_pkixQCSyntax_v2 = new ASN1ObjectIdentifier("1.3.6.1.5.5.7.11.2"); 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/DatagramTransport.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | import java.io.IOException; 4 | 5 | public interface DatagramTransport 6 | { 7 | int getReceiveLimit() 8 | throws IOException; 9 | 10 | int getSendLimit() 11 | throws IOException; 12 | 13 | int receive(byte[] buf, int off, int len, int waitMillis) 14 | throws IOException; 15 | 16 | void send(byte[] buf, int off, int len) 17 | throws IOException; 18 | 19 | void close() 20 | throws IOException; 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/Encodable.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Interface implemented by objects that can be converted into byte arrays. 7 | */ 8 | public interface Encodable 9 | { 10 | /** 11 | * Return a byte array representing the implementing object. 12 | * 13 | * @return a byte array representing the encoding. 14 | * @throws java.io.IOException if an issue arises generation the encoding. 15 | */ 16 | byte[] getEncoded() 17 | throws IOException; 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/GOST3410KeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | public class GOST3410KeyParameters 4 | extends AsymmetricKeyParameter 5 | { 6 | private GOST3410Parameters params; 7 | 8 | public GOST3410KeyParameters( 9 | boolean isPrivate, 10 | GOST3410Parameters params) 11 | { 12 | super(isPrivate); 13 | 14 | this.params = params; 15 | } 16 | 17 | public GOST3410Parameters getParameters() 18 | { 19 | return params; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/encoders/DecoderException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.encoders; 2 | 3 | /** 4 | * Exception thrown if an attempt is made to decode invalid data, or some other failure occurs. 5 | */ 6 | public class DecoderException 7 | extends IllegalStateException 8 | { 9 | private Throwable cause; 10 | 11 | DecoderException(String msg, Throwable cause) 12 | { 13 | super(msg); 14 | 15 | this.cause = cause; 16 | } 17 | 18 | public Throwable getCause() 19 | { 20 | return cause; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/encoders/EncoderException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.encoders; 2 | 3 | /** 4 | * Exception thrown if an attempt is made to encode invalid data, or some other failure occurs. 5 | */ 6 | public class EncoderException 7 | extends IllegalStateException 8 | { 9 | private Throwable cause; 10 | 11 | EncoderException(String msg, Throwable cause) 12 | { 13 | super(msg); 14 | 15 | this.cause = cause; 16 | } 17 | 18 | public Throwable getCause() 19 | { 20 | return cause; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/ISO18033KDFParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import org.ripple.bouncycastle.crypto.DerivationParameters; 4 | 5 | /** 6 | * parameters for Key derivation functions for ISO-18033 7 | */ 8 | public class ISO18033KDFParameters 9 | implements DerivationParameters 10 | { 11 | byte[] seed; 12 | 13 | public ISO18033KDFParameters( 14 | byte[] seed) 15 | { 16 | this.seed = seed; 17 | } 18 | 19 | public byte[] getSeed() 20 | { 21 | return seed; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/IESKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.security.Key; 4 | import java.security.PrivateKey; 5 | import java.security.PublicKey; 6 | 7 | /** 8 | * key pair for use with an integrated encryptor 9 | */ 10 | public interface IESKey 11 | extends Key 12 | { 13 | /** 14 | * return the intended recipient's/sender's public key. 15 | */ 16 | public PublicKey getPublic(); 17 | 18 | /** 19 | * return the local private key. 20 | */ 21 | public PrivateKey getPrivate(); 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1ApplicationSpecificParser.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Interface to parse ASN.1 application specific objects. 7 | */ 8 | public interface ASN1ApplicationSpecificParser 9 | extends ASN1Encodable, InMemoryRepresentable 10 | { 11 | /** 12 | * Read the next object in the parser. 13 | * 14 | * @return an ASN1Encodable 15 | * @throws IOException on a parsing or decoding error. 16 | */ 17 | ASN1Encodable readObject() 18 | throws IOException; 19 | } 20 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/GOST3410PrivateKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class GOST3410PrivateKeyParameters 6 | extends GOST3410KeyParameters 7 | { 8 | private BigInteger x; 9 | 10 | public GOST3410PrivateKeyParameters( 11 | BigInteger x, 12 | GOST3410Parameters params) 13 | { 14 | super(true, params); 15 | 16 | this.x = x; 17 | } 18 | 19 | public BigInteger getX() 20 | { 21 | return x; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/GOST3410PublicKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class GOST3410PublicKeyParameters 6 | extends GOST3410KeyParameters 7 | { 8 | private BigInteger y; 9 | 10 | public GOST3410PublicKeyParameters( 11 | BigInteger y, 12 | GOST3410Parameters params) 13 | { 14 | super(false, params); 15 | 16 | this.y = y; 17 | } 18 | 19 | public BigInteger getY() 20 | { 21 | return y; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/spec/RepeatedSecretKeySpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.spec; 2 | 3 | /** 4 | * A simple object to indicate that a symmetric cipher should reuse the 5 | * last key provided. 6 | * @deprecated use super class org.ripple.bouncycastle.jcajce.spec.RepeatedSecretKeySpec 7 | */ 8 | public class RepeatedSecretKeySpec 9 | extends org.ripple.bouncycastle.jcajce.spec.RepeatedSecretKeySpec 10 | { 11 | private String algorithm; 12 | 13 | public RepeatedSecretKeySpec(String algorithm) 14 | { 15 | super(algorithm); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1SetParser.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * A basic parser for a SET object 7 | */ 8 | public interface ASN1SetParser 9 | extends ASN1Encodable, InMemoryRepresentable 10 | { 11 | /** 12 | * Read the next object from the underlying object representing a SET. 13 | * 14 | * @throws IOException for bad input stream. 15 | * @return the next object, null if we are at the end. 16 | */ 17 | public ASN1Encodable readObject() 18 | throws IOException; 19 | } 20 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/encoders/Encoder.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.encoders; 2 | 3 | import java.io.IOException; 4 | import java.io.OutputStream; 5 | 6 | /** 7 | * Encode and decode byte arrays (typically from binary to 7-bit ASCII 8 | * encodings). 9 | */ 10 | public interface Encoder 11 | { 12 | int encode(byte[] data, int off, int length, OutputStream out) throws IOException; 13 | 14 | int decode(byte[] data, int off, int length, OutputStream out) throws IOException; 15 | 16 | int decode(String data, OutputStream out) throws IOException; 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DERObjectIdentifier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | /** 4 | * 5 | * @deprecated Use ASN1ObjectIdentifier instead of this, 6 | */ 7 | public class DERObjectIdentifier 8 | extends ASN1ObjectIdentifier 9 | { 10 | public DERObjectIdentifier(String identifier) 11 | { 12 | super(identifier); 13 | } 14 | 15 | DERObjectIdentifier(byte[] bytes) 16 | { 17 | super(bytes); 18 | } 19 | 20 | DERObjectIdentifier(ASN1ObjectIdentifier oid, String branch) 21 | { 22 | super(oid, branch); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ripple-client/src/main/java/com/ripple/client/transport/WebSocketTransport.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.transport; 2 | 3 | import org.json.JSONObject; 4 | 5 | import java.net.URI; 6 | 7 | public interface WebSocketTransport { 8 | public abstract void setHandler(TransportEventHandler events); 9 | public abstract void sendMessage(JSONObject msg); 10 | public abstract void connect(URI url); 11 | /** 12 | * It's the responsibility of implementations to trigger 13 | * {@link com.ripple.client.transport.TransportEventHandler#onDisconnected} 14 | */ 15 | public abstract void disconnect(); 16 | } 17 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/known/tx/txns/TicketCancel.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.known.tx.txns; 2 | 3 | import com.ripple.core.coretypes.hash.Hash256; 4 | import com.ripple.core.serialized.enums.TransactionType; 5 | import com.ripple.core.types.known.tx.Transaction; 6 | 7 | public class TicketCancel extends Transaction { 8 | public TicketCancel() { 9 | super(TransactionType.TicketCancel); 10 | } 11 | public Hash256 ticketID() { 12 | return get(Hash256.TicketID); 13 | } 14 | public void ticketID(Hash256 id) { 15 | put(Hash256.TicketID, id); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/ASN1SequenceParser.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * A basic parser for a SEQUENCE object 7 | */ 8 | public interface ASN1SequenceParser 9 | extends ASN1Encodable, InMemoryRepresentable 10 | { 11 | /** 12 | * Read the next object from the underlying object representing a SEQUENCE. 13 | * 14 | * @throws IOException for bad input stream. 15 | * @return the next object, null if we are at the end. 16 | */ 17 | ASN1Encodable readObject() 18 | throws IOException; 19 | } 20 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/Wrapper.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | public interface Wrapper 4 | { 5 | public void init(boolean forWrapping, CipherParameters param); 6 | 7 | /** 8 | * Return the name of the algorithm the wrapper implements. 9 | * 10 | * @return the name of the algorithm the wrapper implements. 11 | */ 12 | public String getAlgorithmName(); 13 | 14 | public byte[] wrap(byte[] in, int inOff, int inLen); 15 | 16 | public byte[] unwrap(byte[] in, int inOff, int inLen) 17 | throws InvalidCipherTextException; 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/FiniteFieldDHEGroup.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /* 4 | * draft-ietf-tls-negotiated-ff-dhe-01 5 | */ 6 | public class FiniteFieldDHEGroup 7 | { 8 | public static final short ffdhe2432 = 0; 9 | public static final short ffdhe3072 = 1; 10 | public static final short ffdhe4096 = 2; 11 | public static final short ffdhe6144 = 3; 12 | public static final short ffdhe8192 = 4; 13 | 14 | public static boolean isValid(short group) 15 | { 16 | return group >= ffdhe2432 && group <= ffdhe8192; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/eac/BidirectionalMap.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.eac; 2 | 3 | import java.util.Hashtable; 4 | 5 | public class BidirectionalMap 6 | extends Hashtable 7 | { 8 | private static final long serialVersionUID = -7457289971962812909L; 9 | 10 | Hashtable reverseMap = new Hashtable(); 11 | 12 | public Object getReverse(Object o) 13 | { 14 | return reverseMap.get(o); 15 | } 16 | 17 | public Object put(Object key, Object o) 18 | { 19 | reverseMap.put(o, key); 20 | return super.put(key, o); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/gmss/GMSSKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.gmss; 2 | 3 | import org.ripple.bouncycastle.crypto.params.AsymmetricKeyParameter; 4 | 5 | public class GMSSKeyParameters 6 | extends AsymmetricKeyParameter 7 | { 8 | private GMSSParameters params; 9 | 10 | public GMSSKeyParameters( 11 | boolean isPrivate, 12 | GMSSParameters params) 13 | { 14 | super(isPrivate); 15 | this.params = params; 16 | } 17 | 18 | public GMSSParameters getParameters() 19 | { 20 | return params; 21 | } 22 | } -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DERGeneralizedTime.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * DER Generalized time object. 7 | */ 8 | public class DERGeneralizedTime 9 | extends ASN1GeneralizedTime 10 | { 11 | 12 | DERGeneralizedTime(byte[] bytes) 13 | { 14 | super(bytes); 15 | } 16 | 17 | public DERGeneralizedTime(Date time) 18 | { 19 | super(time); 20 | } 21 | 22 | public DERGeneralizedTime(String time) 23 | { 24 | super(time); 25 | } 26 | 27 | // TODO: create proper DER encoding. 28 | } 29 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/smime/SMIMECapabilitiesAttribute.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.smime; 2 | 3 | import org.ripple.bouncycastle.asn1.DERSequence; 4 | import org.ripple.bouncycastle.asn1.DERSet; 5 | import org.ripple.bouncycastle.asn1.cms.Attribute; 6 | 7 | public class SMIMECapabilitiesAttribute 8 | extends Attribute 9 | { 10 | public SMIMECapabilitiesAttribute( 11 | SMIMECapabilityVector capabilities) 12 | { 13 | super(SMIMEAttributes.smimeCapabilities, 14 | new DERSet(new DERSequence(capabilities.toASN1EncodableVector()))); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/i18n/filter/Filter.java: -------------------------------------------------------------------------------- 1 | 2 | package org.ripple.bouncycastle.i18n.filter; 3 | 4 | public interface Filter 5 | { 6 | 7 | /** 8 | * Runs the filter on the input String and returns the filtered String 9 | * @param input input String 10 | * @return filtered String 11 | */ 12 | public String doFilter(String input); 13 | 14 | /** 15 | * Runs the filter on the input url and returns the filtered String 16 | * @param input input url String 17 | * @return filtered String 18 | */ 19 | public String doFilterUrl(String input); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/provider/asymmetric/util/ExtendedInvalidKeySpecException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.provider.asymmetric.util; 2 | 3 | import java.security.spec.InvalidKeySpecException; 4 | 5 | public class ExtendedInvalidKeySpecException 6 | extends InvalidKeySpecException 7 | { 8 | private Throwable cause; 9 | 10 | public ExtendedInvalidKeySpecException(String msg, Throwable cause) 11 | { 12 | super(msg); 13 | 14 | this.cause = cause; 15 | } 16 | 17 | public Throwable getCause() 18 | { 19 | return cause; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/spec/ECKeySpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.spec; 2 | 3 | import java.security.spec.KeySpec; 4 | 5 | /** 6 | * base class for an Elliptic Curve Key Spec 7 | */ 8 | public class ECKeySpec 9 | implements KeySpec 10 | { 11 | private ECParameterSpec spec; 12 | 13 | protected ECKeySpec( 14 | ECParameterSpec spec) 15 | { 16 | this.spec = spec; 17 | } 18 | 19 | /** 20 | * return the domain parameters for the curve 21 | */ 22 | public ECParameterSpec getParams() 23 | { 24 | return spec; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ripple-core/src/test/java/com/ripple/crypto/sjcljson/JSEscapeTest.java: -------------------------------------------------------------------------------- 1 | 2 | package com.ripple.crypto.sjcljson; 3 | 4 | import org.junit.Test; 5 | 6 | import static org.junit.Assert.assertEquals; 7 | 8 | public class JSEscapeTest { 9 | @Test 10 | public void testEncodings() { 11 | assertSane("エォオカガキ", "%u30A8%u30A9%u30AA%u30AB%u30AC%u30AD"); 12 | assertSane("wtf bbq?? -- this", "wtf%20bbq%3F%3F%20--%20this"); 13 | } 14 | 15 | private void assertSane(String raw, String escaped) { 16 | assertEquals(raw, JSEscape.unescape(escaped)); 17 | assertEquals(escaped, JSEscape.escape(raw)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/ec/ECUtil.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.ec; 2 | 3 | import java.math.BigInteger; 4 | import java.security.SecureRandom; 5 | 6 | import org.ripple.bouncycastle.math.ec.ECConstants; 7 | 8 | class ECUtil 9 | { 10 | static BigInteger generateK(BigInteger n, SecureRandom random) 11 | { 12 | int nBitLength = n.bitLength(); 13 | BigInteger k; 14 | do 15 | { 16 | k = new BigInteger(nBitLength, random); 17 | } 18 | while (k.equals(ECConstants.ZERO) || (k.compareTo(n) >= 0)); 19 | return k; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/exception/ExtCertificateEncodingException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.exception; 2 | 3 | import java.security.cert.CertificateEncodingException; 4 | 5 | public class ExtCertificateEncodingException 6 | extends CertificateEncodingException 7 | implements ExtException 8 | { 9 | private Throwable cause; 10 | 11 | public ExtCertificateEncodingException(String message, Throwable cause) 12 | { 13 | super(message); 14 | this.cause = cause; 15 | } 16 | 17 | public Throwable getCause() 18 | { 19 | return cause; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ripple-client/src/main/java/com/ripple/client/pubsub/CallbackContext.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.pubsub; 2 | 3 | public abstract class CallbackContext { 4 | public void execute(Runnable runnable) { 5 | runnable.run(); 6 | } 7 | // TODO: perhaps this interface/class/concept 8 | // can be expanded (and subsequently renamed .. CallbackContext ??) 9 | // to automatically remove an ContextedCallback 10 | // Perhaps `once` can be reimplemented in these terms too ;) 11 | public boolean shouldExecute() { 12 | return true; 13 | } 14 | public boolean shouldRemove() { 15 | return false; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-10 15 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/provider/util/AsymmetricKeyInfoConverter.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.provider.util; 2 | 3 | import java.io.IOException; 4 | import java.security.PrivateKey; 5 | import java.security.PublicKey; 6 | 7 | import org.ripple.bouncycastle.asn1.pkcs.PrivateKeyInfo; 8 | import org.ripple.bouncycastle.asn1.x509.SubjectPublicKeyInfo; 9 | 10 | public interface AsymmetricKeyInfoConverter 11 | { 12 | PrivateKey generatePrivate(PrivateKeyInfo keyInfo) 13 | throws IOException; 14 | 15 | PublicKey generatePublic(SubjectPublicKeyInfo keyInfo) 16 | throws IOException; 17 | } 18 | -------------------------------------------------------------------------------- /ripple-examples/ripple-java-8/src/main/java/com/ripple/java8/utils/Func.java: -------------------------------------------------------------------------------- 1 | package com.ripple.java8.utils; 2 | 3 | import java.util.function.BiConsumer; 4 | import java.util.function.Consumer; 5 | import java.util.function.Function; 6 | 7 | public class Func { 8 | public static Consumer bind(BiConsumer consumer, Y bind) { 9 | return t -> consumer.accept(t, bind); 10 | } 11 | 12 | public static boolean itThrows(Function func, T value) { 13 | try { 14 | func.apply(value); 15 | return false; 16 | } catch (Exception e) { 17 | return true; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/src/main/java/com/ripple/android/JSON.java: -------------------------------------------------------------------------------- 1 | package com.ripple.android; 2 | 3 | import org.json.JSONException; 4 | import org.json.JSONObject; 5 | 6 | public class JSON { 7 | public static JSONObject parseJSON(String s) { 8 | try { 9 | return new JSONObject(s); 10 | } catch (JSONException e) { 11 | throw new RuntimeException(e); 12 | } 13 | } 14 | 15 | public static String prettyJSON(JSONObject jsonObject) { 16 | try { 17 | return jsonObject.toString(4); 18 | } catch (JSONException e) { 19 | throw new RuntimeException(e); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/util/Dump.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.util; 2 | 3 | import java.io.FileInputStream; 4 | 5 | import org.ripple.bouncycastle.asn1.ASN1InputStream; 6 | 7 | public class Dump 8 | { 9 | public static void main( 10 | String args[]) 11 | throws Exception 12 | { 13 | FileInputStream fIn = new FileInputStream(args[0]); 14 | ASN1InputStream bIn = new ASN1InputStream(fIn); 15 | Object obj = null; 16 | 17 | while ((obj = bIn.readObject()) != null) 18 | { 19 | System.out.println(ASN1Dump.dumpAsString(obj)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/PRFAlgorithm.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 5246 5 | *

6 | * Note that the values here are implementation-specific and arbitrary. It is recommended not to 7 | * depend on the particular values (e.g. serialization). 8 | */ 9 | public class PRFAlgorithm 10 | { 11 | /* 12 | * Placeholder to refer to the legacy TLS algorithm 13 | */ 14 | public static final int tls_prf_legacy = 0; 15 | 16 | public static final int tls_prf_sha256 = 1; 17 | 18 | /* 19 | * Implied by RFC 5288 20 | */ 21 | public static final int tls_prf_sha384 = 2; 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/ntru/NTRUEncryptionKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.ntru; 2 | 3 | import org.ripple.bouncycastle.crypto.params.AsymmetricKeyParameter; 4 | 5 | public class NTRUEncryptionKeyParameters 6 | extends AsymmetricKeyParameter 7 | { 8 | final protected NTRUEncryptionParameters params; 9 | 10 | public NTRUEncryptionKeyParameters(boolean privateKey, NTRUEncryptionParameters params) 11 | { 12 | super(privateKey); 13 | this.params = params; 14 | } 15 | 16 | public NTRUEncryptionParameters getParameters() 17 | { 18 | return params; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/mceliece/McElieceKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.mceliece; 2 | 3 | import org.ripple.bouncycastle.crypto.params.AsymmetricKeyParameter; 4 | 5 | 6 | public class McElieceKeyParameters 7 | extends AsymmetricKeyParameter 8 | { 9 | private McElieceParameters params; 10 | 11 | public McElieceKeyParameters( 12 | boolean isPrivate, 13 | McElieceParameters params) 14 | { 15 | super(isPrivate); 16 | this.params = params; 17 | } 18 | 19 | 20 | public McElieceParameters getParameters() 21 | { 22 | return params; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /ripple-core/src/test/java/com/ripple/core/coretypes/QualityTest.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.coretypes; 2 | 3 | import com.ripple.core.coretypes.hash.Hash256; 4 | import org.junit.Test; 5 | 6 | import java.math.BigDecimal; 7 | 8 | import static junit.framework.TestCase.assertEquals; 9 | 10 | public class QualityTest { 11 | @Test 12 | public void testFromBookDirectory() throws Exception { 13 | Hash256 hash256 = Hash256.translate.fromString("4627DFFCFF8B5A265EDBD8AE8C14A52325DBFEDAF4F5C32E5C08A1FB2E56F800"); 14 | assertEquals(0, BigDecimal.valueOf(24.299) 15 | .compareTo(Quality.fromBookDirectory(hash256, true, false))); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/io/pem/PemObjectParser.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.io.pem; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Base interface for parsers to convert PEM objects into specific objects. 7 | */ 8 | public interface PemObjectParser 9 | { 10 | /** 11 | * Parse an object out of the PEM object passed in. 12 | * 13 | * @param obj the PEM object containing the details for the specific object. 14 | * @return a specific object represented by the PEM object. 15 | * @throws IOException on a parsing error. 16 | */ 17 | Object parseObject(PemObject obj) 18 | throws IOException; 19 | } 20 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/CCMParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | /** 4 | * @deprecated use AEADParameters 5 | */ 6 | public class CCMParameters 7 | extends AEADParameters 8 | { 9 | /** 10 | * Base constructor. 11 | * 12 | * @param key key to be used by underlying cipher 13 | * @param macSize macSize in bits 14 | * @param nonce nonce to be used 15 | * @param associatedText associated text, if any 16 | */ 17 | public CCMParameters(KeyParameter key, int macSize, byte[] nonce, byte[] associatedText) 18 | { 19 | super(key, macSize, nonce, associatedText); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/PKCS12BagAttributeCarrier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.util.Enumeration; 4 | 5 | import org.ripple.bouncycastle.asn1.ASN1Encodable; 6 | import org.ripple.bouncycastle.asn1.ASN1ObjectIdentifier; 7 | 8 | /** 9 | * allow us to set attributes on objects that can go into a PKCS12 store. 10 | */ 11 | public interface PKCS12BagAttributeCarrier 12 | { 13 | void setBagAttribute( 14 | ASN1ObjectIdentifier oid, 15 | ASN1Encodable attribute); 16 | 17 | ASN1Encodable getBagAttribute( 18 | ASN1ObjectIdentifier oid); 19 | 20 | Enumeration getBagAttributeKeys(); 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/test/UncloseableOutputStream.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.test; 2 | 3 | import java.io.FilterOutputStream; 4 | import java.io.IOException; 5 | import java.io.OutputStream; 6 | 7 | public class UncloseableOutputStream extends FilterOutputStream 8 | { 9 | public UncloseableOutputStream(OutputStream s) 10 | { 11 | super(s); 12 | } 13 | 14 | public void close() 15 | { 16 | throw new RuntimeException("close() called on UncloseableOutputStream"); 17 | } 18 | 19 | public void write(byte[] b, int off, int len) throws IOException 20 | { 21 | out.write(b, off, len); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/io/CipherIOException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.io; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * {@link IOException} wrapper around an exception indicating a problem with the use of a cipher. 7 | */ 8 | public class CipherIOException 9 | extends IOException 10 | { 11 | private static final long serialVersionUID = 1L; 12 | 13 | private final Throwable cause; 14 | 15 | public CipherIOException(String message, Throwable cause) 16 | { 17 | super(message); 18 | 19 | this.cause = cause; 20 | } 21 | 22 | public Throwable getCause() 23 | { 24 | return cause; 25 | } 26 | } -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/mceliece/McElieceCCA2KeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.mceliece; 2 | 3 | import org.ripple.bouncycastle.crypto.params.AsymmetricKeyParameter; 4 | 5 | 6 | public class McElieceCCA2KeyParameters 7 | extends AsymmetricKeyParameter 8 | { 9 | private McElieceCCA2Parameters params; 10 | 11 | public McElieceCCA2KeyParameters( 12 | boolean isPrivate, 13 | McElieceCCA2Parameters params) 14 | { 15 | super(isPrivate); 16 | this.params = params; 17 | } 18 | 19 | 20 | public McElieceCCA2Parameters getParameters() 21 | { 22 | return params; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/math/linearalgebra/RandUtils.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.math.linearalgebra; 2 | 3 | import java.security.SecureRandom; 4 | 5 | public class RandUtils 6 | { 7 | static int nextInt(SecureRandom rand, int n) 8 | { 9 | 10 | if ((n & -n) == n) // i.e., n is a power of 2 11 | { 12 | return (int)((n * (long)(rand.nextInt() >>> 1)) >> 31); 13 | } 14 | 15 | int bits, value; 16 | do 17 | { 18 | bits = rand.nextInt() >>> 1; 19 | value = bits % n; 20 | } 21 | while (bits - value + (n - 1) < 0); 22 | 23 | return value; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/io/InvalidCipherTextIOException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.io; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * {@link IOException} wrapper around an exception indicating an invalid ciphertext, such as in 7 | * authentication failure during finalisation of an AEAD cipher. For use in streams that need to 8 | * expose invalid ciphertext errors. 9 | */ 10 | public class InvalidCipherTextIOException 11 | extends CipherIOException 12 | { 13 | private static final long serialVersionUID = 1L; 14 | 15 | public InvalidCipherTextIOException(String message, Throwable cause) 16 | { 17 | super(message, cause); 18 | } 19 | } -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/EphemeralKeyPair.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | public class EphemeralKeyPair 4 | { 5 | private AsymmetricCipherKeyPair keyPair; 6 | private KeyEncoder publicKeyEncoder; 7 | 8 | public EphemeralKeyPair(AsymmetricCipherKeyPair keyPair, KeyEncoder publicKeyEncoder) 9 | { 10 | this.keyPair = keyPair; 11 | this.publicKeyEncoder = publicKeyEncoder; 12 | } 13 | 14 | public AsymmetricCipherKeyPair getKeyPair() 15 | { 16 | return keyPair; 17 | } 18 | 19 | public byte[] getEncodedPublicKey() 20 | { 21 | return publicKeyEncoder.getEncoded(keyPair.getPublic()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/KeyEncapsulation.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * The basic interface for key encapsulation mechanisms. 5 | */ 6 | public interface KeyEncapsulation 7 | { 8 | /** 9 | * Initialise the key encapsulation mechanism. 10 | */ 11 | public void init(CipherParameters param); 12 | 13 | /** 14 | * Encapsulate a randomly generated session key. 15 | */ 16 | public CipherParameters encrypt(byte[] out, int outOff, int keyLen); 17 | 18 | /** 19 | * Decapsulate an encapsulated session key. 20 | */ 21 | public CipherParameters decrypt(byte[] in, int inOff, int inLen, int keyLen); 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/RuntimeCryptoException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * the foundation class for the exceptions thrown by the crypto packages. 5 | */ 6 | public class RuntimeCryptoException 7 | extends RuntimeException 8 | { 9 | /** 10 | * base constructor. 11 | */ 12 | public RuntimeCryptoException() 13 | { 14 | } 15 | 16 | /** 17 | * create a RuntimeCryptoException with the given message. 18 | * 19 | * @param message the message to be carried with the exception. 20 | */ 21 | public RuntimeCryptoException( 22 | String message) 23 | { 24 | super(message); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/rainbow/RainbowKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.rainbow; 2 | 3 | import org.ripple.bouncycastle.crypto.params.AsymmetricKeyParameter; 4 | 5 | public class RainbowKeyParameters 6 | extends AsymmetricKeyParameter 7 | { 8 | private int docLength; 9 | 10 | public RainbowKeyParameters( 11 | boolean isPrivate, 12 | int docLength) 13 | { 14 | super(isPrivate); 15 | this.docLength = docLength; 16 | } 17 | 18 | /** 19 | * @return the docLength 20 | */ 21 | public int getDocLength() 22 | { 23 | return this.docLength; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/io/pem/PemGenerationException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.io.pem; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * Exception thrown on failure to generate a PEM object. 7 | */ 8 | public class PemGenerationException 9 | extends IOException 10 | { 11 | private Throwable cause; 12 | 13 | public PemGenerationException(String message, Throwable cause) 14 | { 15 | super(message); 16 | this.cause = cause; 17 | } 18 | 19 | public PemGenerationException(String message) 20 | { 21 | super(message); 22 | } 23 | 24 | public Throwable getCause() 25 | { 26 | return cause; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/math/ntru/polynomial/TernaryPolynomial.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.math.ntru.polynomial; 2 | 3 | /** 4 | * A polynomial whose coefficients are all equal to -1, 0, or 1 5 | */ 6 | public interface TernaryPolynomial 7 | extends Polynomial 8 | { 9 | 10 | /** 11 | * Multiplies the polynomial by an IntegerPolynomial, taking the indices mod N 12 | */ 13 | IntegerPolynomial mult(IntegerPolynomial poly2); 14 | 15 | int[] getOnes(); 16 | 17 | int[] getNegOnes(); 18 | 19 | /** 20 | * Returns the maximum number of coefficients the polynomial can have 21 | */ 22 | int size(); 23 | 24 | void clear(); 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/MemoableResetException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | /** 4 | * Exception to be thrown on a failure to reset an object implementing Memoable. 5 | *

6 | * The exception extends ClassCastException to enable users to have a single handling case, 7 | * only introducing specific handling of this one if required. 8 | *

9 | */ 10 | public class MemoableResetException 11 | extends ClassCastException 12 | { 13 | /** 14 | * Basic Constructor. 15 | * 16 | * @param msg message to be associated with this exception. 17 | */ 18 | public MemoableResetException(String msg) 19 | { 20 | super(msg); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/StringList.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util; 2 | 3 | public interface StringList 4 | extends Iterable 5 | { 6 | boolean add(String s); 7 | 8 | String get(int index); 9 | 10 | int size(); 11 | 12 | String[] toStringArray(); 13 | 14 | /** 15 | * Return a section of the contents of the list. If the list is too short the array is filled with nulls. 16 | * 17 | * @param from the initial index of the range to be copied, inclusive 18 | * @param to the final index of the range to be copied, exclusive. 19 | * @return an array of length to - from 20 | */ 21 | String[] toStringArray(int from, int to); 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/generators/KDF1BytesGenerator.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.generators; 2 | 3 | import org.ripple.bouncycastle.crypto.Digest; 4 | 5 | /** 6 | * KDF1 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033 7 | *
8 | * This implementation is based on ISO 18033/IEEE P1363a. 9 | */ 10 | public class KDF1BytesGenerator 11 | extends BaseKDFBytesGenerator 12 | { 13 | /** 14 | * Construct a KDF1 byte generator. 15 | *

16 | * @param digest the digest to be used as the source of derived keys. 17 | */ 18 | public KDF1BytesGenerator( 19 | Digest digest) 20 | { 21 | super(0, digest); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/DSAKeyGenerationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.security.SecureRandom; 4 | 5 | import org.ripple.bouncycastle.crypto.KeyGenerationParameters; 6 | 7 | public class DSAKeyGenerationParameters 8 | extends KeyGenerationParameters 9 | { 10 | private DSAParameters params; 11 | 12 | public DSAKeyGenerationParameters( 13 | SecureRandom random, 14 | DSAParameters params) 15 | { 16 | super(random, params.getP().bitLength() - 1); 17 | 18 | this.params = params; 19 | } 20 | 21 | public DSAParameters getParameters() 22 | { 23 | return params; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/exception/ExtException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.exception; 2 | 3 | /** 4 | * 5 | * This is an extended exception. Java before version 1.4 did not offer the 6 | * possibility the attach a cause to an exception. The cause of an exception is 7 | * the Throwable object which was thrown and caused the 8 | * exception. This interface must be implemented by all exceptions to accomplish 9 | * this additional functionality. 10 | * 11 | */ 12 | public interface ExtException 13 | { 14 | 15 | /** 16 | * Returns the cause of the exception. 17 | * 18 | * @return The cause of the exception. 19 | */ 20 | Throwable getCause(); 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/DoubleAddMultiplier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class DoubleAddMultiplier extends AbstractECMultiplier 6 | { 7 | /** 8 | * Joye's double-add algorithm. 9 | */ 10 | protected ECPoint multiplyPositive(ECPoint p, BigInteger k) 11 | { 12 | ECPoint[] R = new ECPoint[]{ p.getCurve().getInfinity(), p }; 13 | 14 | int n = k.bitLength(); 15 | for (int i = 0; i < n; ++i) 16 | { 17 | int b = k.testBit(i) ? 1 : 0; 18 | int bp = 1 - b; 19 | R[bp] = R[bp].twicePlus(R[b]); 20 | } 21 | 22 | return R[0]; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/known/sle/LedgerHashes.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.known.sle; 2 | 3 | import com.ripple.core.coretypes.Vector256; 4 | import com.ripple.core.coretypes.uint.UInt32; 5 | import com.ripple.core.serialized.enums.LedgerEntryType; 6 | 7 | public class LedgerHashes extends LedgerEntry { 8 | public LedgerHashes() { 9 | super(LedgerEntryType.LedgerHashes); 10 | } 11 | 12 | public Vector256 hashes() { 13 | return get(Vector256.Hashes); 14 | } 15 | 16 | public void hashes(Vector256 hashes) { 17 | put(Vector256.Hashes, hashes); 18 | } 19 | 20 | public UInt32 lastLedgerSequence() { 21 | return get(UInt32.LastLedgerSequence); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/ECMultiplier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * Interface for classes encapsulating a point multiplication algorithm 7 | * for ECPoints. 8 | */ 9 | public interface ECMultiplier 10 | { 11 | /** 12 | * Multiplies the ECPoint p by k, i.e. 13 | * p is added k times to itself. 14 | * @param p The ECPoint to be multiplied. 15 | * @param k The factor by which p is multiplied. 16 | * @return p multiplied by k. 17 | */ 18 | ECPoint multiply(ECPoint p, BigInteger k); 19 | } 20 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/gmss/GMSSKeyGenerationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.gmss; 2 | 3 | import java.security.SecureRandom; 4 | 5 | import org.ripple.bouncycastle.crypto.KeyGenerationParameters; 6 | 7 | public class GMSSKeyGenerationParameters 8 | extends KeyGenerationParameters 9 | { 10 | 11 | private GMSSParameters params; 12 | 13 | public GMSSKeyGenerationParameters( 14 | SecureRandom random, 15 | GMSSParameters params) 16 | { 17 | // XXX key size? 18 | super(random, 1); 19 | this.params = params; 20 | } 21 | 22 | public GMSSParameters getParameters() 23 | { 24 | return params; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/known/sle/entries/OfferDirectory.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.known.sle.entries; 2 | 3 | import com.ripple.core.coretypes.Issue; 4 | import com.ripple.core.coretypes.IssuePair; 5 | 6 | public class OfferDirectory extends DirectoryNode { 7 | public IssuePair issuePair() { 8 | return new IssuePair(takerPaysIssue(), takerGetsIssue()); 9 | } 10 | 11 | public Issue takerGetsIssue() { 12 | // TODO: remove wrapper 13 | return Issue.from160s(takerGetsCurrency(), takerGetsIssuer()); 14 | } 15 | public Issue takerPaysIssue() { 16 | // TODO: remove wrapper 17 | return Issue.from160s(takerPaysCurrency(), takerPaysIssuer()); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.ripple 8 | ripple-lib-java 9 | 0.0.1-SNAPSHOT 10 | 11 | com.ripple 12 | ripple-bouncycastle 13 | 0.0.1-SNAPSHOT 14 | ripple-bouncycastle 15 | http://maven.apache.org 16 | jar 17 | 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/x509/qualified/ETSIQCObjectIdentifiers.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.x509.qualified; 2 | 3 | import org.ripple.bouncycastle.asn1.ASN1ObjectIdentifier; 4 | 5 | public interface ETSIQCObjectIdentifiers 6 | { 7 | static final ASN1ObjectIdentifier id_etsi_qcs_QcCompliance = new ASN1ObjectIdentifier("0.4.0.1862.1.1"); 8 | static final ASN1ObjectIdentifier id_etsi_qcs_LimiteValue = new ASN1ObjectIdentifier("0.4.0.1862.1.2"); 9 | static final ASN1ObjectIdentifier id_etsi_qcs_RetentionPeriod = new ASN1ObjectIdentifier("0.4.0.1862.1.3"); 10 | static final ASN1ObjectIdentifier id_etsi_qcs_QcSSCD = new ASN1ObjectIdentifier("0.4.0.1862.1.4"); 11 | } 12 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/prng/EntropySource.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.prng; 2 | 3 | public interface EntropySource 4 | { 5 | /** 6 | * Return whether or not this entropy source is regarded as prediction resistant. 7 | * 8 | * @return true if it is, false otherwise. 9 | */ 10 | boolean isPredictionResistant(); 11 | 12 | /** 13 | * Return a byte array of entropy. 14 | * 15 | * @return entropy bytes. 16 | */ 17 | byte[] getEntropy(); 18 | 19 | /** 20 | * Return the number of bits of entropy this source can produce. 21 | * 22 | * @return size in bits of the return value of getEntropy. 23 | */ 24 | int entropySize(); 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/util/encoders/Translator.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.util.encoders; 2 | 3 | /** 4 | * General interface for an translator. 5 | */ 6 | public interface Translator 7 | { 8 | /** 9 | * size of the output block on encoding produced by getDecodedBlockSize() 10 | * bytes. 11 | */ 12 | public int getEncodedBlockSize(); 13 | 14 | public int encode(byte[] in, int inOff, int length, byte[] out, int outOff); 15 | 16 | /** 17 | * size of the output block on decoding produced by getEncodedBlockSize() 18 | * bytes. 19 | */ 20 | public int getDecodedBlockSize(); 21 | 22 | public int decode(byte[] in, int inOff, int length, byte[] out, int outOff); 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/KDFParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import org.ripple.bouncycastle.crypto.DerivationParameters; 4 | 5 | /** 6 | * parameters for Key derivation functions for IEEE P1363a 7 | */ 8 | public class KDFParameters 9 | implements DerivationParameters 10 | { 11 | byte[] iv; 12 | byte[] shared; 13 | 14 | public KDFParameters( 15 | byte[] shared, 16 | byte[] iv) 17 | { 18 | this.shared = shared; 19 | this.iv = iv; 20 | } 21 | 22 | public byte[] getSharedSecret() 23 | { 24 | return shared; 25 | } 26 | 27 | public byte[] getIV() 28 | { 29 | return iv; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/KeyParameter.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import org.ripple.bouncycastle.crypto.CipherParameters; 4 | 5 | public class KeyParameter 6 | implements CipherParameters 7 | { 8 | private byte[] key; 9 | 10 | public KeyParameter( 11 | byte[] key) 12 | { 13 | this(key, 0, key.length); 14 | } 15 | 16 | public KeyParameter( 17 | byte[] key, 18 | int keyOff, 19 | int keyLen) 20 | { 21 | this.key = new byte[keyLen]; 22 | 23 | System.arraycopy(key, keyOff, this.key, 0, keyLen); 24 | } 25 | 26 | public byte[] getKey() 27 | { 28 | return key; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/BasicAgreement.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * The basic interface that basic Diffie-Hellman implementations 7 | * conforms to. 8 | */ 9 | public interface BasicAgreement 10 | { 11 | /** 12 | * initialise the agreement engine. 13 | */ 14 | void init(CipherParameters param); 15 | 16 | /** 17 | * return the field size for the agreement algorithm in bytes. 18 | */ 19 | int getFieldSize(); 20 | 21 | /** 22 | * given a public key from a given party calculate the next 23 | * message in the agreement sequence. 24 | */ 25 | BigInteger calculateAgreement(CipherParameters pubKey); 26 | } 27 | -------------------------------------------------------------------------------- /ripple-client-transports/ripple-client-java-websocket-transport/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.ripple 7 | ripple-client-transports 8 | 0.0.1-SNAPSHOT 9 | 10 | com.ripple 11 | ripple-client-java-websocket-transport 12 | 0.0.1-SNAPSHOT 13 | ripple-client-java-websocket-transport 14 | http://maven.apache.org 15 | 16 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/AsymmetricCipherKeyPairGenerator.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * interface that a public/private key pair generator should conform to. 5 | */ 6 | public interface AsymmetricCipherKeyPairGenerator 7 | { 8 | /** 9 | * intialise the key pair generator. 10 | * 11 | * @param param the parameters the key pair is to be initialised with. 12 | */ 13 | public void init(KeyGenerationParameters param); 14 | 15 | /** 16 | * return an AsymmetricCipherKeyPair containing the generated keys. 17 | * 18 | * @return an AsymmetricCipherKeyPair containing the generated keys. 19 | */ 20 | public AsymmetricCipherKeyPair generateKeyPair(); 21 | } 22 | 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/MaxBytesExceededException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * this exception is thrown whenever a cipher requires a change of key, iv 5 | * or similar after x amount of bytes enciphered 6 | */ 7 | public class MaxBytesExceededException 8 | extends RuntimeCryptoException 9 | { 10 | /** 11 | * base constructor. 12 | */ 13 | public MaxBytesExceededException() 14 | { 15 | } 16 | 17 | /** 18 | * create an with the given message. 19 | * 20 | * @param message the message to be carried with the exception. 21 | */ 22 | public MaxBytesExceededException( 23 | String message) 24 | { 25 | super(message); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/BulkCipherAlgorithm.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 2246 5 | *

6 | * Note that the values here are implementation-specific and arbitrary. It is recommended not to 7 | * depend on the particular values (e.g. serialization). 8 | */ 9 | public class BulkCipherAlgorithm 10 | { 11 | public static final int _null = 0; 12 | public static final int rc4 = 1; 13 | public static final int rc2 = 2; 14 | public static final int des = 3; 15 | public static final int _3des = 4; 16 | public static final int des40 = 5; 17 | 18 | /* 19 | * RFC 4346 20 | */ 21 | public static final int aes = 6; 22 | public static final int idea = 7; 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/mceliece/McElieceKeyGenerationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.mceliece; 2 | 3 | import java.security.SecureRandom; 4 | 5 | import org.ripple.bouncycastle.crypto.KeyGenerationParameters; 6 | 7 | public class McElieceKeyGenerationParameters 8 | extends KeyGenerationParameters 9 | { 10 | private McElieceParameters params; 11 | 12 | public McElieceKeyGenerationParameters( 13 | SecureRandom random, 14 | McElieceParameters params) 15 | { 16 | // XXX key size? 17 | super(random, 256); 18 | this.params = params; 19 | } 20 | 21 | public McElieceParameters getParameters() 22 | { 23 | return params; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/ParametersWithSBox.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import org.ripple.bouncycastle.crypto.CipherParameters; 4 | 5 | public class ParametersWithSBox 6 | implements CipherParameters 7 | { 8 | private CipherParameters parameters; 9 | private byte[] sBox; 10 | 11 | public ParametersWithSBox( 12 | CipherParameters parameters, 13 | byte[] sBox) 14 | { 15 | this.parameters = parameters; 16 | this.sBox = sBox; 17 | } 18 | 19 | public byte[] getSBox() 20 | { 21 | return sBox; 22 | } 23 | 24 | public CipherParameters getParameters() 25 | { 26 | return parameters; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/MontgomeryLadderMultiplier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class MontgomeryLadderMultiplier extends AbstractECMultiplier 6 | { 7 | /** 8 | * Montgomery ladder. 9 | */ 10 | protected ECPoint multiplyPositive(ECPoint p, BigInteger k) 11 | { 12 | ECPoint[] R = new ECPoint[]{ p.getCurve().getInfinity(), p }; 13 | 14 | int n = k.bitLength(); 15 | int i = n; 16 | while (--i >= 0) 17 | { 18 | int b = k.testBit(i) ? 1 : 0; 19 | int bp = 1 - b; 20 | R[bp] = R[bp].add(R[b]); 21 | R[b] = R[b].twice(); 22 | } 23 | return R[0]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012,2013,2014 Ripple Labs Inc. 2 | 3 | Permission to use, copy, modify, and distribute this software for any 4 | purpose with or without fee is hereby granted, provided that the above 5 | copyright notice and this permission notice appear in all copies. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 13 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/spec/ECNamedCurveGenParameterSpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.spec; 2 | 3 | import java.security.spec.AlgorithmParameterSpec; 4 | 5 | /** 6 | * Named curve generation spec 7 | *

8 | * If you are using JDK 1.5 you should be looking at ECGenParameterSpec. 9 | */ 10 | public class ECNamedCurveGenParameterSpec 11 | implements AlgorithmParameterSpec 12 | { 13 | private String name; 14 | 15 | public ECNamedCurveGenParameterSpec( 16 | String name) 17 | { 18 | this.name = name; 19 | } 20 | 21 | /** 22 | * return the name of the curve the EC domain parameters belong to. 23 | */ 24 | public String getName() 25 | { 26 | return name; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/AlertLevel.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 5246 7.2 5 | */ 6 | public class AlertLevel 7 | { 8 | public static final short warning = 1; 9 | public static final short fatal = 2; 10 | 11 | public static String getName(short alertDescription) 12 | { 13 | switch (alertDescription) 14 | { 15 | case warning: 16 | return "warning"; 17 | case fatal: 18 | return "fatal"; 19 | default: 20 | return "UNKNOWN"; 21 | } 22 | } 23 | 24 | public static String getText(short alertDescription) 25 | { 26 | return getName(alertDescription) + "(" + alertDescription + ")"; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/MACAlgorithm.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | /** 4 | * RFC 2246 5 | *

6 | * Note that the values here are implementation-specific and arbitrary. It is recommended not to 7 | * depend on the particular values (e.g. serialization). 8 | */ 9 | public class MACAlgorithm 10 | { 11 | public static final int _null = 0; 12 | public static final int md5 = 1; 13 | public static final int sha = 2; 14 | 15 | /* 16 | * RFC 5246 17 | */ 18 | public static final int hmac_md5 = md5; 19 | public static final int hmac_sha1 = sha; 20 | public static final int hmac_sha256 = 3; 21 | public static final int hmac_sha384 = 4; 22 | public static final int hmac_sha512 = 5; 23 | } 24 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/spec/ElGamalGenParameterSpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.spec; 2 | 3 | import java.security.spec.AlgorithmParameterSpec; 4 | 5 | public class ElGamalGenParameterSpec 6 | implements AlgorithmParameterSpec 7 | { 8 | private int primeSize; 9 | 10 | /* 11 | * @param primeSize the size (in bits) of the prime modulus. 12 | */ 13 | public ElGamalGenParameterSpec( 14 | int primeSize) 15 | { 16 | this.primeSize = primeSize; 17 | } 18 | 19 | /** 20 | * Returns the size in bits of the prime modulus. 21 | * 22 | * @return the size in bits of the prime modulus 23 | */ 24 | public int getPrimeSize() 25 | { 26 | return primeSize; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/mceliece/McElieceCCA2KeyGenerationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.mceliece; 2 | 3 | import java.security.SecureRandom; 4 | 5 | import org.ripple.bouncycastle.crypto.KeyGenerationParameters; 6 | 7 | public class McElieceCCA2KeyGenerationParameters 8 | extends KeyGenerationParameters 9 | { 10 | private McElieceCCA2Parameters params; 11 | 12 | public McElieceCCA2KeyGenerationParameters( 13 | SecureRandom random, 14 | McElieceCCA2Parameters params) 15 | { 16 | // XXX key size? 17 | super(random, 128); 18 | this.params = params; 19 | } 20 | 21 | public McElieceCCA2Parameters getParameters() 22 | { 23 | return params; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DERInteger.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * @deprecated Use ASN1Integer instead of this, 7 | */ 8 | public class DERInteger 9 | extends ASN1Integer 10 | { 11 | /** 12 | * Constructor from a byte array containing a signed representation of the number. 13 | * 14 | * @param bytes a byte array containing the signed number.A copy is made of the byte array. 15 | */ 16 | public DERInteger(byte[] bytes) 17 | { 18 | super(bytes, true); 19 | } 20 | 21 | public DERInteger(BigInteger value) 22 | { 23 | super(value); 24 | } 25 | 26 | public DERInteger(long value) 27 | { 28 | super(value); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/ECKeyGenerationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.security.SecureRandom; 4 | 5 | import org.ripple.bouncycastle.crypto.KeyGenerationParameters; 6 | 7 | public class ECKeyGenerationParameters 8 | extends KeyGenerationParameters 9 | { 10 | private ECDomainParameters domainParams; 11 | 12 | public ECKeyGenerationParameters( 13 | ECDomainParameters domainParams, 14 | SecureRandom random) 15 | { 16 | super(random, domainParams.getN().bitLength()); 17 | 18 | this.domainParams = domainParams; 19 | } 20 | 21 | public ECDomainParameters getDomainParameters() 22 | { 23 | return domainParams; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/MQVPrivateKey.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | import java.security.PrivateKey; 4 | import java.security.PublicKey; 5 | 6 | /** 7 | * Static/ephemeral private key (pair) for use with ECMQV key agreement 8 | * (Optionally provides the ephemeral public key) 9 | */ 10 | public interface MQVPrivateKey 11 | extends PrivateKey 12 | { 13 | /** 14 | * return the static private key. 15 | */ 16 | PrivateKey getStaticPrivateKey(); 17 | 18 | /** 19 | * return the ephemeral private key. 20 | */ 21 | PrivateKey getEphemeralPrivateKey(); 22 | 23 | /** 24 | * return the ephemeral public key (may be null). 25 | */ 26 | PublicKey getEphemeralPublicKey(); 27 | } 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.class 3 | .idea/* 4 | out/* 5 | *.iml 6 | lib/*.gz 7 | scripts/* 8 | lib/bcprov-jdk15on-149/* 9 | dump.json 10 | examples/android/assets/dev-credentials.json 11 | ripple-examples/ripple-cli/src/main/java/com/ripple/cli/AnalyzeAccountState.java 12 | binary-transactions.json 13 | ripple-bouncycastle/target/ 14 | .settings/ 15 | .project 16 | target/ 17 | *.json 18 | ripple-examples/ripple-cli/src/main/java/com/ripple/cli/MakePayment2.java 19 | ripple-examples/ripple-data/ 20 | ripple-core/src/main/java/com/ripple/core/types/shamap2 21 | ripple-core/src/main/java/com/ripple/core/types/paths/ 22 | dump.txt 23 | bla.txt 24 | librocksdbjni.so 25 | nohup.out 26 | ripple-core/src/test/java/com/ripple/core/types/paths 27 | ripple-core/src/test/java/com/ripple/core/types/shamap2 28 | dirty-in-ledger-* -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/digests/EncodableDigest.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.digests; 2 | 3 | /** 4 | * Encodable digests allow you to download an encoded copy of their internal state. This is useful for the situation where 5 | * you need to generate a signature on an external device and it allows for "sign with last round", so a copy of the 6 | * internal state of the digest, plus the last few blocks of the message are all that needs to be sent, rather than the 7 | * entire message. 8 | */ 9 | public interface EncodableDigest 10 | { 11 | /** 12 | * Return an encoded byte array for the digest's internal state 13 | * 14 | * @return an encoding of the digests internal state. 15 | */ 16 | byte[] getEncodedState(); 17 | } 18 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/jcajce/spec/GMSSKeySpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.jcajce.spec; 2 | 3 | import java.security.spec.KeySpec; 4 | 5 | import org.ripple.bouncycastle.pqc.crypto.gmss.GMSSParameters; 6 | 7 | public class GMSSKeySpec 8 | implements KeySpec 9 | { 10 | /** 11 | * The GMSSParameterSet 12 | */ 13 | private GMSSParameters gmssParameterSet; 14 | 15 | protected GMSSKeySpec(GMSSParameters gmssParameterSet) 16 | { 17 | this.gmssParameterSet = gmssParameterSet; 18 | } 19 | 20 | /** 21 | * Returns the GMSS parameter set 22 | * 23 | * @return The GMSS parameter set 24 | */ 25 | public GMSSParameters getParameters() 26 | { 27 | return gmssParameterSet; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/serialized/StreamSink.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.serialized; 2 | 3 | import java.io.IOException; 4 | import java.io.OutputStream; 5 | 6 | public class StreamSink implements BytesSink { 7 | OutputStream out; 8 | 9 | public StreamSink(OutputStream out) { 10 | this.out = out; 11 | } 12 | 13 | @Override 14 | public void add(byte aByte) { 15 | try { 16 | out.write(aByte); 17 | } catch (IOException e) { 18 | throw new RuntimeException(e); 19 | } 20 | } 21 | 22 | @Override 23 | public void add(byte[] bytes) { 24 | try { 25 | out.write(bytes); 26 | } catch (IOException e) { 27 | throw new RuntimeException(e); 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DLOutputStream.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.IOException; 4 | import java.io.OutputStream; 5 | 6 | /** 7 | * Stream that outputs encoding based on definite length. 8 | */ 9 | public class DLOutputStream 10 | extends ASN1OutputStream 11 | { 12 | public DLOutputStream( 13 | OutputStream os) 14 | { 15 | super(os); 16 | } 17 | 18 | public void writeObject( 19 | ASN1Encodable obj) 20 | throws IOException 21 | { 22 | if (obj != null) 23 | { 24 | obj.toASN1Primitive().toDLObject().encode(this); 25 | } 26 | else 27 | { 28 | throw new IOException("null object detected"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/spec/RepeatedSecretKeySpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.spec; 2 | 3 | 4 | import javax.crypto.SecretKey; 5 | 6 | /** 7 | * A simple object to indicate that a symmetric cipher should reuse the 8 | * last key provided. 9 | */ 10 | public class RepeatedSecretKeySpec 11 | implements SecretKey 12 | { 13 | private String algorithm; 14 | 15 | public RepeatedSecretKeySpec(String algorithm) 16 | { 17 | this.algorithm = algorithm; 18 | } 19 | 20 | public String getAlgorithm() 21 | { 22 | return algorithm; 23 | } 24 | 25 | public String getFormat() 26 | { 27 | return null; 28 | } 29 | 30 | public byte[] getEncoded() 31 | { 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/RSAKeyParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class RSAKeyParameters 6 | extends AsymmetricKeyParameter 7 | { 8 | private BigInteger modulus; 9 | private BigInteger exponent; 10 | 11 | public RSAKeyParameters( 12 | boolean isPrivate, 13 | BigInteger modulus, 14 | BigInteger exponent) 15 | { 16 | super(isPrivate); 17 | 18 | this.modulus = modulus; 19 | this.exponent = exponent; 20 | } 21 | 22 | public BigInteger getModulus() 23 | { 24 | return modulus; 25 | } 26 | 27 | public BigInteger getExponent() 28 | { 29 | return exponent; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/MGFParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import org.ripple.bouncycastle.crypto.DerivationParameters; 4 | 5 | /** 6 | * parameters for mask derivation functions. 7 | */ 8 | public class MGFParameters 9 | implements DerivationParameters 10 | { 11 | byte[] seed; 12 | 13 | public MGFParameters( 14 | byte[] seed) 15 | { 16 | this(seed, 0, seed.length); 17 | } 18 | 19 | public MGFParameters( 20 | byte[] seed, 21 | int off, 22 | int len) 23 | { 24 | this.seed = new byte[len]; 25 | System.arraycopy(seed, off, this.seed, 0, len); 26 | } 27 | 28 | public byte[] getSeed() 29 | { 30 | return seed; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ripple-core/src/test/java/com/ripple/core/serialized/BytesListTest.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.serialized; 2 | 3 | import org.junit.Test; 4 | 5 | import static junit.framework.TestCase.assertEquals; 6 | 7 | public class BytesListTest { 8 | @Test 9 | public void testNested() throws Exception { 10 | 11 | BytesList ba1 = new BytesList(); 12 | BytesList ba2 = new BytesList(); 13 | 14 | ba1.add(new byte[]{'a', 'b', 'c'}); 15 | ba1.add(new byte[]{'d', 'e'}); 16 | 17 | ba2.add(new byte[]{'f', 'g'}); 18 | ba2.add((byte) 'h'); 19 | ba2.add(ba1); 20 | 21 | assertEquals(ba2.bytesLength(), 8); 22 | byte[] bytes = ba2.bytes(); 23 | String ascii = new String(bytes, "ascii"); 24 | 25 | assertEquals("fghabcde", ascii); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/src/main/java/com/ripple/android/client/AndroidClient.java: -------------------------------------------------------------------------------- 1 | package com.ripple.android.client; 2 | 3 | import com.ripple.android.logging.AndroidHandler; 4 | import com.ripple.client.Client; 5 | import com.ripple.client.transport.impl.JavaWebSocketTransportImpl; 6 | 7 | import java.util.logging.Level; 8 | import java.util.logging.Logger; 9 | 10 | public class AndroidClient extends Client { 11 | static { 12 | Logger logger = Client.logger; 13 | AndroidHandler handler = new AndroidHandler(); 14 | handler.setLevel(Level.ALL); 15 | logger.addHandler(handler); 16 | logger.setLevel(Level.ALL); 17 | logger.setUseParentHandlers(false); 18 | } 19 | public AndroidClient() { 20 | super(new JavaWebSocketTransportImpl()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/GOST3410KeyGenerationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import org.ripple.bouncycastle.crypto.KeyGenerationParameters; 4 | 5 | import java.security.SecureRandom; 6 | 7 | public class GOST3410KeyGenerationParameters 8 | extends KeyGenerationParameters 9 | { 10 | private GOST3410Parameters params; 11 | 12 | public GOST3410KeyGenerationParameters( 13 | SecureRandom random, 14 | GOST3410Parameters params) 15 | { 16 | super(random, params.getP().bitLength() - 1); 17 | 18 | this.params = params; 19 | } 20 | 21 | public GOST3410Parameters getParameters() 22 | { 23 | return params; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/ZSignedDigitL2RMultiplier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class ZSignedDigitL2RMultiplier extends AbstractECMultiplier 6 | { 7 | /** 8 | * 'Zeroless' Signed Digit Left-to-Right. 9 | */ 10 | protected ECPoint multiplyPositive(ECPoint p, BigInteger k) 11 | { 12 | ECPoint addP = p.normalize(), subP = addP.negate(); 13 | 14 | ECPoint R0 = addP; 15 | 16 | int n = k.bitLength(); 17 | int s = k.getLowestSetBit(); 18 | 19 | int i = n; 20 | while (--i > s) 21 | { 22 | R0 = R0.twicePlus(k.testBit(i) ? addP : subP); 23 | } 24 | 25 | R0 = R0.timesPow2(s); 26 | 27 | return R0; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/CramerShoupKeyGenerationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.security.SecureRandom; 4 | 5 | import org.ripple.bouncycastle.crypto.KeyGenerationParameters; 6 | 7 | public class CramerShoupKeyGenerationParameters 8 | extends KeyGenerationParameters 9 | { 10 | 11 | private CramerShoupParameters params; 12 | 13 | public CramerShoupKeyGenerationParameters(SecureRandom random, CramerShoupParameters params) 14 | { 15 | super(random, getStrength(params)); 16 | 17 | this.params = params; 18 | } 19 | 20 | public CramerShoupParameters getParameters() 21 | { 22 | return params; 23 | } 24 | 25 | static int getStrength(CramerShoupParameters params) 26 | { 27 | return params.getP().bitLength(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/crypto/rainbow/RainbowKeyGenerationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.crypto.rainbow; 2 | 3 | import java.security.SecureRandom; 4 | 5 | import org.ripple.bouncycastle.crypto.KeyGenerationParameters; 6 | 7 | public class RainbowKeyGenerationParameters 8 | extends KeyGenerationParameters 9 | { 10 | private RainbowParameters params; 11 | 12 | public RainbowKeyGenerationParameters( 13 | SecureRandom random, 14 | RainbowParameters params) 15 | { 16 | // TODO: key size? 17 | super(random, params.getVi()[params.getVi().length - 1] - params.getVi()[0]); 18 | this.params = params; 19 | } 20 | 21 | public RainbowParameters getParameters() 22 | { 23 | return params; 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/coretypes/Flags.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.coretypes; 2 | 3 | import com.ripple.core.fields.Type; 4 | import com.ripple.core.serialized.BytesSink; 5 | import com.ripple.core.serialized.SerializedType; 6 | 7 | import java.util.BitSet; 8 | 9 | // TODO 10 | public class Flags extends BitSet implements SerializedType { 11 | @Override 12 | public Object toJSON() { 13 | return null; 14 | } 15 | 16 | @Override 17 | public byte[] toBytes() { 18 | return new byte[0]; 19 | } 20 | 21 | @Override 22 | public String toHex() { 23 | return null; 24 | } 25 | 26 | @Override 27 | public void toBytesSink(BytesSink to) { 28 | 29 | } 30 | 31 | @Override 32 | public Type type() { 33 | return Type.UInt32; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/DERNull.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.IOException; 4 | 5 | /** 6 | * A NULL object. 7 | */ 8 | public class DERNull 9 | extends ASN1Null 10 | { 11 | public static final DERNull INSTANCE = new DERNull(); 12 | 13 | private static final byte[] zeroBytes = new byte[0]; 14 | 15 | /** 16 | * @deprecated use DERNull.INSTANCE 17 | */ 18 | public DERNull() 19 | { 20 | } 21 | 22 | boolean isConstructed() 23 | { 24 | return false; 25 | } 26 | 27 | int encodedLength() 28 | { 29 | return 2; 30 | } 31 | 32 | void encode( 33 | ASN1OutputStream out) 34 | throws IOException 35 | { 36 | out.writeEncoded(BERTags.NULL, zeroBytes); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/encodings/common/B16.java: -------------------------------------------------------------------------------- 1 | package com.ripple.encodings.common; 2 | 3 | 4 | import static org.ripple.bouncycastle.util.encoders.Hex.toHexString; 5 | 6 | public class B16 { 7 | public static String toStringTrimmed(byte[] bytes) { 8 | int offset = 0; 9 | if (bytes[0] == 0) { 10 | offset = 1; 11 | } 12 | return toHexString(bytes, offset, bytes.length - offset).toUpperCase(); 13 | } 14 | @Deprecated 15 | public static String toString(byte[] bytes) { 16 | return encode(bytes); 17 | } 18 | public static String encode(byte[] bytes) { 19 | return toHexString(bytes).toUpperCase(); 20 | } 21 | public static byte[] decode(String hex) { 22 | return org.ripple.bouncycastle.util.encoders.Hex.decode(hex); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/generators/KDF2BytesGenerator.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.generators; 2 | 3 | import org.ripple.bouncycastle.crypto.Digest; 4 | 5 | /** 6 | * KDF2 generator for derived keys and ivs as defined by IEEE P1363a/ISO 18033 7 | *
8 | * This implementation is based on IEEE P1363/ISO 18033. 9 | */ 10 | public class KDF2BytesGenerator 11 | extends BaseKDFBytesGenerator 12 | { 13 | /** 14 | * Construct a KDF2 bytes generator. Generates key material 15 | * according to IEEE P1363 or ISO 18033 depending on the initialisation. 16 | *

17 | * @param digest the digest to be used as the source of derived keys. 18 | */ 19 | public KDF2BytesGenerator( 20 | Digest digest) 21 | { 22 | super(1, digest); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/interfaces/ECPointEncoder.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.interfaces; 2 | 3 | /** 4 | * All BC elliptic curve keys implement this interface. You need to 5 | * cast the key to get access to it. 6 | *

7 | * By default BC keys produce encodings without point compression, 8 | * to turn this on call setPointFormat() with "COMPRESSED". 9 | */ 10 | public interface ECPointEncoder 11 | { 12 | /** 13 | * Set the formatting for encoding of points. If the String "UNCOMPRESSED" is passed 14 | * in point compression will not be used. If the String "COMPRESSED" is passed point 15 | * compression will be used. The default is "UNCOMPRESSED". 16 | * 17 | * @param style the style to use. 18 | */ 19 | public void setPointFormat(String style); 20 | } 21 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/provider/AnnotatedException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.provider; 2 | 3 | import org.ripple.bouncycastle.jce.exception.ExtException; 4 | 5 | public class AnnotatedException 6 | extends Exception 7 | implements ExtException 8 | { 9 | private Throwable _underlyingException; 10 | 11 | public AnnotatedException(String string, Throwable e) 12 | { 13 | super(string); 14 | 15 | _underlyingException = e; 16 | } 17 | 18 | public AnnotatedException(String string) 19 | { 20 | this(string, null); 21 | } 22 | 23 | Throwable getUnderlyingException() 24 | { 25 | return _underlyingException; 26 | } 27 | 28 | public Throwable getCause() 29 | { 30 | return _underlyingException; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/macs/CMacWithIV.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.macs; 2 | 3 | import org.ripple.bouncycastle.crypto.BlockCipher; 4 | import org.ripple.bouncycastle.crypto.CipherParameters; 5 | 6 | /** 7 | * A non-NIST variant which allows passing of an IV to the underlying CBC cipher. 8 | *

Note: there isn't really a good reason to use an IV here, use the regular CMac where possible.

9 | */ 10 | public class CMacWithIV 11 | extends CMac 12 | { 13 | public CMacWithIV(BlockCipher cipher) 14 | { 15 | super(cipher); 16 | } 17 | 18 | public CMacWithIV(BlockCipher cipher, int macSizeInBits) 19 | { 20 | super(cipher, macSizeInBits); 21 | } 22 | 23 | void validate(CipherParameters params) 24 | { 25 | // accept all 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/tls/ClientCertificateType.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.tls; 2 | 3 | public class ClientCertificateType 4 | { 5 | /* 6 | * RFC 4346 7.4.4 7 | */ 8 | public static final short rsa_sign = 1; 9 | public static final short dss_sign = 2; 10 | public static final short rsa_fixed_dh = 3; 11 | public static final short dss_fixed_dh = 4; 12 | public static final short rsa_ephemeral_dh_RESERVED = 5; 13 | public static final short dss_ephemeral_dh_RESERVED = 6; 14 | public static final short fortezza_dms_RESERVED = 20; 15 | 16 | /* 17 | * RFC 4492 5.5 18 | */ 19 | public static final short ecdsa_sign = 64; 20 | public static final short rsa_fixed_ecdh = 65; 21 | public static final short ecdsa_fixed_ecdh = 66; 22 | } 23 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/spec/ElGamalPublicKeySpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.spec; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * This class specifies an ElGamal public key with its associated parameters. 7 | * 8 | * @see ElGamalPrivateKeySpec 9 | */ 10 | public class ElGamalPublicKeySpec 11 | extends ElGamalKeySpec 12 | { 13 | private BigInteger y; 14 | 15 | public ElGamalPublicKeySpec( 16 | BigInteger y, 17 | ElGamalParameterSpec spec) 18 | { 19 | super(spec); 20 | 21 | this.y = y; 22 | } 23 | 24 | /** 25 | * Returns the public value y. 26 | * 27 | * @return the public value y 28 | */ 29 | public BigInteger getY() 30 | { 31 | return y; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/ZSignedDigitR2LMultiplier.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | import java.math.BigInteger; 4 | 5 | public class ZSignedDigitR2LMultiplier extends AbstractECMultiplier 6 | { 7 | /** 8 | * 'Zeroless' Signed Digit Right-to-Left. 9 | */ 10 | protected ECPoint multiplyPositive(ECPoint p, BigInteger k) 11 | { 12 | ECPoint R0 = p.getCurve().getInfinity(), R1 = p; 13 | 14 | int n = k.bitLength(); 15 | int s = k.getLowestSetBit(); 16 | 17 | R1 = R1.timesPow2(s); 18 | 19 | int i = s; 20 | while (++i < n) 21 | { 22 | R0 = R0.add(k.testBit(i) ? R1 : R1.negate()); 23 | R1 = R1.twice(); 24 | } 25 | 26 | R0 = R0.add(R1); 27 | 28 | return R0; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/spec/ElGamalPrivateKeySpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.spec; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * This class specifies an ElGamal private key with its associated parameters. 7 | * 8 | * @see ElGamalPublicKeySpec 9 | */ 10 | public class ElGamalPrivateKeySpec 11 | extends ElGamalKeySpec 12 | { 13 | private BigInteger x; 14 | 15 | public ElGamalPrivateKeySpec( 16 | BigInteger x, 17 | ElGamalParameterSpec spec) 18 | { 19 | super(spec); 20 | 21 | this.x = x; 22 | } 23 | 24 | /** 25 | * Returns the private value x. 26 | * 27 | * @return the private value x 28 | */ 29 | public BigInteger getX() 30 | { 31 | return x; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ripple-core/src/test/java/com/ripple/encodings/B58IdentifierTest.java: -------------------------------------------------------------------------------- 1 | package com.ripple.encodings; 2 | 3 | import com.ripple.core.TestFixtures; 4 | import org.junit.Assert; 5 | import org.junit.Test; 6 | 7 | import static com.ripple.config.Config.getB58IdentiferCodecs; 8 | import static org.junit.Assert.assertEquals; 9 | 10 | public class B58IdentifierTest { 11 | @Test 12 | public void testDecodeFamilySeed() { 13 | Assert.assertArrayEquals(TestFixtures.master_seed_bytes, 14 | getB58IdentiferCodecs().decodeFamilySeed(TestFixtures.master_seed)); 15 | } 16 | @Test 17 | public void testEncodeFamilySeed() { 18 | String masterSeedStringRebuilt = getB58IdentiferCodecs().encodeFamilySeed(TestFixtures.master_seed_bytes); 19 | assertEquals(TestFixtures.master_seed, masterSeedStringRebuilt); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/spec/ECPrivateKeySpec.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.spec; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * Elliptic Curve private key specification. 7 | */ 8 | public class ECPrivateKeySpec 9 | extends ECKeySpec 10 | { 11 | private BigInteger d; 12 | 13 | /** 14 | * base constructor 15 | * 16 | * @param d the private number for the key. 17 | * @param spec the domain parameters for the curve being used. 18 | */ 19 | public ECPrivateKeySpec( 20 | BigInteger d, 21 | ECParameterSpec spec) 22 | { 23 | super(spec); 24 | 25 | this.d = d; 26 | } 27 | 28 | /** 29 | * return the private number D 30 | */ 31 | public BigInteger getD() 32 | { 33 | return d; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/io/MacOutputStream.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.io; 2 | 3 | import java.io.IOException; 4 | import java.io.OutputStream; 5 | 6 | import javax.crypto.Mac; 7 | 8 | public class MacOutputStream 9 | extends OutputStream 10 | { 11 | protected Mac mac; 12 | 13 | public MacOutputStream( 14 | Mac mac) 15 | { 16 | this.mac = mac; 17 | } 18 | 19 | public void write(int b) 20 | throws IOException 21 | { 22 | mac.update((byte)b); 23 | } 24 | 25 | public void write( 26 | byte[] b, 27 | int off, 28 | int len) 29 | throws IOException 30 | { 31 | mac.update(b, off, len); 32 | } 33 | 34 | public byte[] getMac() 35 | { 36 | return mac.doFinal(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ripple-examples/ripple-cli/src/test/java/com/ripple/cli/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.ripple.cli; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | import junit.framework.TestSuite; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | extends TestCase 12 | { 13 | /** 14 | * Create the test case 15 | * 16 | * @param testName name of the test case 17 | */ 18 | public AppTest( String testName ) 19 | { 20 | super( testName ); 21 | } 22 | 23 | /** 24 | * @return the suite of tests being tested 25 | */ 26 | public static Test suite() 27 | { 28 | return new TestSuite( AppTest.class ); 29 | } 30 | 31 | /** 32 | * Rigourous Test :-) 33 | */ 34 | public void testApp() 35 | { 36 | assertTrue( true ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/LimitedInputStream.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1; 2 | 3 | import java.io.InputStream; 4 | 5 | abstract class LimitedInputStream 6 | extends InputStream 7 | { 8 | protected final InputStream _in; 9 | private int _limit; 10 | 11 | LimitedInputStream( 12 | InputStream in, 13 | int limit) 14 | { 15 | this._in = in; 16 | this._limit = limit; 17 | } 18 | 19 | int getRemaining() 20 | { 21 | // TODO: maybe one day this can become more accurate 22 | return _limit; 23 | } 24 | 25 | protected void setParentEofDetect(boolean on) 26 | { 27 | if (_in instanceof IndefiniteLengthInputStream) 28 | { 29 | ((IndefiniteLengthInputStream)_in).setEofOn00(on); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jcajce/util/BCJcaJceHelper.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jcajce.util; 2 | 3 | import java.security.Provider; 4 | import java.security.Security; 5 | 6 | import org.ripple.bouncycastle.jce.provider.BouncyCastleProvider; 7 | 8 | /** 9 | * A JCA/JCE helper that refers to the BC provider for all it's needs. 10 | */ 11 | public class BCJcaJceHelper 12 | extends ProviderJcaJceHelper 13 | { 14 | private static Provider getBouncyCastleProvider() 15 | { 16 | if (Security.getProvider("BC") != null) 17 | { 18 | return Security.getProvider("BC"); 19 | } 20 | else 21 | { 22 | return new BouncyCastleProvider(); 23 | } 24 | } 25 | 26 | public BCJcaJceHelper() 27 | { 28 | super(getBouncyCastleProvider()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/jce/exception/ExtCertPathBuilderException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.jce.exception; 2 | 3 | import java.security.cert.CertPath; 4 | import java.security.cert.CertPathBuilderException; 5 | 6 | public class ExtCertPathBuilderException 7 | extends CertPathBuilderException 8 | implements ExtException 9 | { 10 | private Throwable cause; 11 | 12 | public ExtCertPathBuilderException(String message, Throwable cause) 13 | { 14 | super(message); 15 | this.cause = cause; 16 | } 17 | 18 | public ExtCertPathBuilderException(String msg, Throwable cause, 19 | CertPath certPath, int index) 20 | { 21 | super(msg, cause); 22 | this.cause = cause; 23 | } 24 | 25 | public Throwable getCause() 26 | { 27 | return cause; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ripple-client/src/test/java/com/ripple/client/subscriptions/ledger/ClearedLedgersSetTest.java: -------------------------------------------------------------------------------- 1 | package com.ripple.client.subscriptions.ledger; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | import static org.junit.Assert.assertFalse; 7 | 8 | public class ClearedLedgersSetTest { 9 | ClearedLedgersSet set = new ClearedLedgersSet(); 10 | { 11 | set.clear(5); 12 | set.clear(1); 13 | set.clear(0); 14 | } 15 | 16 | @Test 17 | public void testOkToClear() throws Exception { 18 | assertFalse(set.okToClear()); 19 | } 20 | 21 | @Test 22 | public void testGaps() throws Exception { 23 | long[] expectedGaps = new long[]{2, 3, 4}; 24 | int i = 0; 25 | for (Long gap : set.gaps()) { 26 | assertEquals(expectedGaps[i++], (long) gap); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /ripple-core/src/main/java/com/ripple/core/types/known/sle/ThreadedLedgerEntry.java: -------------------------------------------------------------------------------- 1 | package com.ripple.core.types.known.sle; 2 | 3 | 4 | import com.ripple.core.coretypes.hash.Hash256; 5 | import com.ripple.core.coretypes.uint.UInt32; 6 | import com.ripple.core.fields.Field; 7 | import com.ripple.core.serialized.enums.LedgerEntryType; 8 | 9 | // this class has a PreviousTxnID and PreviousTxnLgrSeq 10 | abstract public class ThreadedLedgerEntry extends LedgerEntry { 11 | public ThreadedLedgerEntry(LedgerEntryType type) { 12 | super(type); 13 | } 14 | public UInt32 previousTxnLgrSeq() {return get(UInt32.PreviousTxnLgrSeq);} 15 | public Hash256 previousTxnID() {return get(Hash256.PreviousTxnID);} 16 | public void previousTxnLgrSeq(UInt32 val) {put(Field.PreviousTxnLgrSeq, val);} 17 | public void previousTxnID(Hash256 val) {put(Field.PreviousTxnID, val);} 18 | } 19 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/asn1/crmf/SubsequentMessage.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.asn1.crmf; 2 | 3 | import org.ripple.bouncycastle.asn1.ASN1Integer; 4 | 5 | public class SubsequentMessage 6 | extends ASN1Integer 7 | { 8 | public static final SubsequentMessage encrCert = new SubsequentMessage(0); 9 | public static final SubsequentMessage challengeResp = new SubsequentMessage(1); 10 | 11 | private SubsequentMessage(int value) 12 | { 13 | super(value); 14 | } 15 | 16 | public static SubsequentMessage valueOf(int value) 17 | { 18 | if (value == 0) 19 | { 20 | return encrCert; 21 | } 22 | if (value == 1) 23 | { 24 | return challengeResp; 25 | } 26 | 27 | throw new IllegalArgumentException("unknown value: " + value); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/params/DHKeyGenerationParameters.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.params; 2 | 3 | import java.security.SecureRandom; 4 | 5 | import org.ripple.bouncycastle.crypto.KeyGenerationParameters; 6 | 7 | public class DHKeyGenerationParameters 8 | extends KeyGenerationParameters 9 | { 10 | private DHParameters params; 11 | 12 | public DHKeyGenerationParameters( 13 | SecureRandom random, 14 | DHParameters params) 15 | { 16 | super(random, getStrength(params)); 17 | 18 | this.params = params; 19 | } 20 | 21 | public DHParameters getParameters() 22 | { 23 | return params; 24 | } 25 | 26 | static int getStrength(DHParameters params) 27 | { 28 | return params.getL() != 0 ? params.getL() : params.getP().bitLength(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/math/ec/WTauNafPreCompInfo.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.math.ec; 2 | 3 | /** 4 | * Class holding precomputation data for the WTNAF (Window 5 | * τ-adic Non-Adjacent Form) algorithm. 6 | */ 7 | public class WTauNafPreCompInfo implements PreCompInfo 8 | { 9 | /** 10 | * Array holding the precomputed ECPoint.F2ms used for the 11 | * WTNAF multiplication in 12 | * {@link org.ripple.bouncycastle.math.ec.multiplier.WTauNafMultiplier.multiply() 13 | * WTauNafMultiplier.multiply()}. 14 | */ 15 | protected ECPoint.F2m[] preComp = null; 16 | 17 | public ECPoint.F2m[] getPreComp() 18 | { 19 | return preComp; 20 | } 21 | 22 | public void setPreComp(ECPoint.F2m[] preComp) 23 | { 24 | this.preComp = preComp; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/pqc/math/ntru/polynomial/Resultant.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.pqc.math.ntru.polynomial; 2 | 3 | import java.math.BigInteger; 4 | 5 | /** 6 | * Contains a resultant and a polynomial rho such that 7 | * res = rho*this + t*(x^n-1) for some integer t. 8 | * 9 | * @see IntegerPolynomial#resultant() 10 | * @see IntegerPolynomial#resultant(int) 11 | */ 12 | public class Resultant 13 | { 14 | /** 15 | * A polynomial such that res = rho*this + t*(x^n-1) for some integer t 16 | */ 17 | public BigIntPolynomial rho; 18 | /** 19 | * Resultant of a polynomial with x^n-1 20 | */ 21 | public BigInteger res; 22 | 23 | Resultant(BigIntPolynomial rho, BigInteger res) 24 | { 25 | this.rho = rho; 26 | this.res = res; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/DataLengthException.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * this exception is thrown if a buffer that is meant to have output 5 | * copied into it turns out to be too short, or if we've been given 6 | * insufficient input. In general this exception will get thrown rather 7 | * than an ArrayOutOfBounds exception. 8 | */ 9 | public class DataLengthException 10 | extends RuntimeCryptoException 11 | { 12 | /** 13 | * base constructor. 14 | */ 15 | public DataLengthException() 16 | { 17 | } 18 | 19 | /** 20 | * create a DataLengthException with the given message. 21 | * 22 | * @param message the message to be carried with the exception. 23 | */ 24 | public DataLengthException( 25 | String message) 26 | { 27 | super(message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ripple-examples/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.ripple 8 | ripple-lib-java 9 | 0.0.1-SNAPSHOT 10 | 11 | com.ripple 12 | ripple-examples 13 | 0.0.1-SNAPSHOT 14 | ripple-examples 15 | http://maven.apache.org 16 | pom 17 | 18 | ripple-android 19 | ripple-cli 20 | ripple-java-8 21 | 22 | 23 | -------------------------------------------------------------------------------- /ripple-examples/ripple-android/src/main/java/com/ripple/android/activities/SplashScreen.java: -------------------------------------------------------------------------------- 1 | package com.ripple.android.activities; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.os.Handler; 7 | import com.ripple.android.R; 8 | 9 | public class SplashScreen extends Activity { 10 | public void onCreate(Bundle savedInstanceState) { 11 | super.onCreate(savedInstanceState); 12 | setContentView(R.layout.splash_screen); 13 | new Handler().postDelayed(new Runnable() { 14 | @Override 15 | public void run() { 16 | Intent intent; 17 | intent = new Intent(); 18 | intent.setClass(SplashScreen.this, PaymentAlternatives.class); 19 | startActivity(intent); 20 | finish(); 21 | } 22 | }, 2000); 23 | } 24 | } -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/Committer.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto; 2 | 3 | /** 4 | * General interface fdr classes that produce and validate commitments. 5 | */ 6 | public interface Committer 7 | { 8 | /** 9 | * Generate a commitment for the passed in message. 10 | * 11 | * @param message the message to be committed to, 12 | * @return a Commitment 13 | */ 14 | Commitment commit(byte[] message); 15 | 16 | /** 17 | * Return true if the passed in commitment represents a commitment to the passed in maessage. 18 | * 19 | * @param commitment a commitment previously generated. 20 | * @param message the message that was expected to have been committed to. 21 | * @return true if commitment matches message, false otherwise. 22 | */ 23 | boolean isRevealed(Commitment commitment, byte[] message); 24 | } 25 | -------------------------------------------------------------------------------- /ripple-bouncycastle/src/main/java/org/ripple/bouncycastle/crypto/io/SignerOutputStream.java: -------------------------------------------------------------------------------- 1 | package org.ripple.bouncycastle.crypto.io; 2 | 3 | import java.io.IOException; 4 | import java.io.OutputStream; 5 | 6 | import org.ripple.bouncycastle.crypto.Signer; 7 | 8 | public class SignerOutputStream 9 | extends OutputStream 10 | { 11 | protected Signer signer; 12 | 13 | public SignerOutputStream( 14 | Signer Signer) 15 | { 16 | this.signer = Signer; 17 | } 18 | 19 | public void write(int b) 20 | throws IOException 21 | { 22 | signer.update((byte)b); 23 | } 24 | 25 | public void write( 26 | byte[] b, 27 | int off, 28 | int len) 29 | throws IOException 30 | { 31 | signer.update(b, off, len); 32 | } 33 | 34 | public Signer getSigner() 35 | { 36 | return signer; 37 | } 38 | } 39 | --------------------------------------------------------------------------------